Answers for "python replace date time column"

0

python replace date time column

df['Date'] = df['Date'].mask(df['Date'].dt.year == 2216, df['Date'] - 
                                                         pd.to_timedelta(200, unit='y') + 
                                                         pd.to_timedelta(12, unit='h'))
print (df)
        Date
0 2016-12-21
1 2016-12-23
2 2016-01-31
3 2016-12-23
4 2016-12-27
5 2016-12-25
6 2016-12-23
Posted by: Guest on May-05-2022

Code answers related to "python replace date time column"

Python Answers by Framework

Browse Popular Code Answers by Language