I have written a code to do a date modification to reduce 1 day on 2/29/2008. The code successfully executes and shows me the output but it does not update the dataframe.
Name Maint Start Date
Yasin 02/29/08
Susy 01/04/15
James 04/14/06
I wrote the below code it gave me the output but it did not update the dataframe
spend_sw[spend_sw['Maint Start Date'] == '02/29/2008'].apply(lambda x: pd.datetime(x['Maint Start Date'].year , x['Maint Start Date'].month, x['Maint Start Date'].day - 1), axis=1)
Then I modified it to but all the fields which did not have the leap year dat became blank.
spend_sw['Maint Start Date'] = spend_sw[spend_sw['Maint Start Date'] == '02/29/2008'].apply(lambda x: pd.datetime(x['Maint Start Date'].year , x['Maint Start Date'].month, x['Maint Start Date'].day - 1), axis=1)
Can you please tell me how can I modify the values to the existing dataframe.