Replies: 2 comments
-
By default a date is forced to be a python datetime.date object unless you set date_as_pandas_datetime in which case it is a pandas datetime type, pandas chooses it automatically, and keeps changing, so I am not sure what it is these days. A datetime will be parsed to a pandas type, whatever pandas chooses it to be. I did not understood what you are trying to do, but if you have dates or datetimes beyond the ranges of the default objects, you can set the option disable_datetime_conversion, then you get numbers that you xan convert manually to the object type of your preference. A pandas |
Beta Was this translation helpful? Give feedback.
-
Also, I think you are mixing up datetime.date and datetime.datetime? A date may be stored as datetime.date , which max is the year 9999. So by default you are covered. A date will never be stored as a datetime.datetime. A date is defined as such in the source file sas, spss or stata. A datetime is different, defined again at source and will be a pandas datetime/timestamp/whatever it wants it to be. Pandas is smart and you cannot force it to be a datetime.datetime (or it used to be like that at least) |
Beta Was this translation helpful? Give feedback.
-
Can you elaborate when a date will be stored as a python datetime object and when a date will be stored as a pandas Timestamp?
The reason why I ask is that it would be great to store everything in a datetime object so we don't have to worry about the Timestamp max limit of 2262-04-11. I see there is an option date_as_pandas_datetime but it says that if it's a true date, then it would be pandas datetime64 so does that mean that it will fall back to python datetime if needed?
Beta Was this translation helpful? Give feedback.
All reactions