I have a DataFrame df and I tried to iterate each row to map values of two columns to new values, but I have problems passing in the dictionary containing the map to df.apply
df.apply(lambda row: (map_dict[row['colA']], map_dict[row['colB']]), axis=1, args=(map_dict,), map_dict=map_dict)
I got the error message
File "<console>", line 1
SyntaxError: Generator expression must be parenthesized if not sole argument
I tried to read the official doc , but I struggle to understand its explanation on args parameter http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html
I have also tried passing in map_dict as either keyword or positional argument, but I still get the same error
df[['colA','colB']].apply(map_dict)?