Python syntax error in version 2.6 -


this question has answer here:

i'm not familiar python need fix script throws syntax error in version 2.6. can explain problem?

import pandas pd .... d = pd.read_csv(csv_filename, skiprows=skip).to_dict() d = {k: d[k].values() k in d} 

this error message:

d = {k: d[k].values() k in d}                             ^ syntaxerror: invalid syntax 

dictionary comprehensions new feature in 2.7, , aren't valid syntax in earlier versions. instead, pass dict generator expression of two-tuples:

d = dict((k, d[k].values()) k in d) 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -