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
Post a Comment