Reputation: 30
I have a series that contains datetime data.
When I want to use Series.unique().tolist()
, it seems that the datetime was automatically converted to an int.
Please see the example below. I now realized that it is not necessary as I can iterate over Series.unique()
, but just out of curiosity does anyone know why?
Thank you 🙂
Upvotes: 0
Views: 492
Reputation: 36
I guess you may find the answer here.
Long story short: you are trying to convert from numpy.datetime64
type (output of .unique()
), which is not present in vanilla python, so it is being cast to int.
Workaround is using list()
:
list(sch['Datetime_sch'].unique())
Upvotes: 1