I have an exported csv file that contains extracted climate data from netCDF file, however the Date column has exported as below list, I would like to change this column to normal datetime. Is there any solution please! Thanks!
(cftime.Datetime360Day(2006, 1, 1, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 2, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 3, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 4, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 5, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 6, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 7, 12, 0, 0, 0, has_year_zero=True),)
(cftime.Datetime360Day(2006, 1, 8, 12, 0, 0, 0, has_year_zero=True),)
I would like to change this column to normal datetime. Is there any solution please! Thanks!
CodePudding user response:
I assume you've tried pandas pd.to_datetime()
already, right?
If not, give that a shot. It generally works really well.
CodePudding user response:
Datetime360Day is a calendar with every year being 360 days long (divided into 30 day months)
Generally (in around all languages) if there is no means that can help you to do the conversion natively :
You have to use the datetime api and format a string coming from the calendar output.
Regards