I have a dataframe with date and value fields. I need to change the value in a field if the date matches. Here is a dataset:
date confirmed deaths
701 2020-03-02 NaN NaN
702 2020-03-03 NaN NaN
703 2020-03-04 NaN NaN
704 2020-03-05 NaN NaN
705 2020-03-06 NaN NaN
Specially made a slice of the data to make it clearer. I want to enter the value 2
for the date 2020-03-04
in the deaths
field. How can I do this? Based exactly on the date
field.
At the output I want to get this:
date confirmed deaths
701 2020-03-02 NaN NaN
702 2020-03-03 NaN NaN
703 2020-03-04 NaN 2
704 2020-03-05 NaN NaN
705 2020-03-06 NaN NaN
I tried several ways but it didn't work for some reason. Can you help?