Skip to content
Advertisement

Replace column values between two dataframes according to index

I have a dataframe named calls, each call is recorded by a date (calls)[datetime]. each call has an answer status (calls)[Status].

JavaScript

A second Dataframe named NewStatus with same column (NewStatus)[datetime] and the column (NewStatus)[New_Status] that I want to replace in the first dataframe with a date join

JavaScript

Desired result is the following for calls :

datetime Status
2021-11-22 18:47:02 AB_CL_NO
2021-01-08 14:18:11 REP
2021-06-08 16:40:45 AB_AUT
2021-12-03 10:21:31 DROP
2021-12-03 15:21:31 MLR_ST

By using

JavaScript

I am blocked how to replace the old Status by making the join with “datetime”

Advertisement

Answer

You could do it like this:

UPDATE Be aware that pd.update works inplace.

JavaScript

Old answer

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement