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
So I am going to assume your first dataframe is called df1 and your second one is called df2. Then this would work:
df1 = df1.drop('DMR', 1)
df = merge(df1, df2, on = 'Wrestler')
Just drop DMR from the first dataframe and then merge them on the Wrestler column.
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.