python - Why is very time consuming to transform a pandas-series with pandas-datetime values into a list? -
I had a panda data frame with the date given in the strings as a column (xmpell before the first stage, after the first phase and after the second phase The same operation to check The contents of the used column: I have seen that when the date is Can anyone explain this behavior? "2014- 10- 17 ". I wanted to keep these values as python date objects. I decided to make this change in two steps:
df.col = pandas .to_datetime (df.col) Df.col = df.map (lambda x: x.date ())
df.col.tolist () [: 5]
string < The above operation operation was fast relative to / code> or
datetime.date
On the contrary, when the date was given in the form of the code pandas.datetime
, the operation was quite slow.
Comments
Post a Comment