- #1
- 2,168
- 193
I have two data frames df1 and df2
df1 has two columns 'player_name' and 'player_id'.
Similarly df2 has 'player_id' column.
From this configuration I want to pass 'player_name' column to df2 by using 'player_id'. For this reason I have tried something like this,
The code runs without error and I obtain 'player_name' column in df2 but all the values are NaN. I did not understand why this happens.
df1 has two columns 'player_name' and 'player_id'.
Similarly df2 has 'player_id' column.
From this configuration I want to pass 'player_name' column to df2 by using 'player_id'. For this reason I have tried something like this,
Code:
df2['player_name'] = df2['player_api_id'].map(df1['player_name'])
The code runs without error and I obtain 'player_name' column in df2 but all the values are NaN. I did not understand why this happens.