2017-04-05 7 views

答えて

1

することができますSeriesまたはdictreplaceを使用します。

df['msg'] = df['msg'].replace(dictionary.set_index('old_msg')['new_msg']) 
print (df) 
     msg 
0  the 
1  wi 
2  fi 
3 account 

または:

df['msg'] = df['msg'].replace(dictionary.set_index('old_msg')['new_msg'].to_dict()) 
print (df) 
     msg 
0  the 
1  wi 
2  fi 
3 account 
+0

あなたは救い主です:) –

関連する問題