i\'m trying get better at Python and decided to do some analysis on one of my passions. Wrestling! In this case, Japanese Wrestling!
Basically I\'m trying to update valu
Use map by Series
:
df1['DMR'] = df1['Wrestler'].map(df2.set_index('Wrestler')['DMR'])
Or merge with left join
and drop for remove column:
df1 = pd.merge(df1.drop('DMR', axis=1), df2, how='left')
print (df1)
Wrestler Matches DMR
0 TETSUYA NAITO 9 4.000000
1 HIROSHI TANAHASHI 9 4.111111
2 BAD LUCK FALE 9 3.166667
3 KOTA IBUSHI 9 4.222222
4 ZACK SABRE JR. 9 3.611111
5 HIROOKI GOTO 9 3.694444
6 TOMOHIRO ISHII 9 4.250000
7 TOGI MAKABE 9 3.611111
8 YOSHI-HASHI 9 3.638889
9 YUJI NAGATA 9 4.138889
Notice:
Values in Wrestler
column in df2
have to be unique.