How to change the date index in time series data from 2/1/59 to 2/1/1959. It always defaults to 2/1/2059 (Python)

14 Views Asked by At

Data Set

Hi all,

I have a data set in Python where the index is a time series and has the format as '%d%m%y. However, I want ot change it to %d%m%Y (four digit year instead of two digit year). The problem I am having is that my data goes from 1959 - 2023. It starts at 2/1/59 and ends at 10/1/23. When i convert to %d%m%Y. The data changes to 2059 instead of 1959. It eliminates any 1900s data.

How can i change my time series index to %d%m%Y, while starting in the 1900s instead of automatically converting 59 to 1959.

Thanks!

I have tried to add 1900 if year is above '50' and add 2000 if year is below '50', but this doesnt work because it doesn't recognize year because it's not in datetime format. and if i do change it to date time format '59' (1959) gets converted to 2059.

0

There are 0 best solutions below