I try to set converters in Pandas when loading data. I have a list of names of columns l=["col1", ..., "col10"] and this works
converters = {c: func1 for c in l} but when I try to add more columns converters = {c: func1 for c in l, "col11": func2} then I got invalid syntax error. What should I change?
Asked
Active
Viewed 14 times
0
Placer
- 37
- 4
-
1Looks like you're trying to combine a dict comprehension and an assignment. Try doing it on two separate lines ```converters = {c: func1 for c in l}``` then: ```converters["col11"] = func2``` – mitoRibo Feb 11 '22 at 22:30