Answers for "map two columns with dictionary"

1

pandas map using two columns

df['d'] = df.apply(lambda x: some_func(a = x['a'], b = x['b'], c = x['c']), axis=1)
Posted by: Guest on October-21-2021
1

python how to create dict from dataframe based on 2 columns

In [9]: pd.Series(df.Letter.values,index=df.Position).to_dict()
Out[9]: {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}
Posted by: Guest on January-15-2021

Code answers related to "map two columns with dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language