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 "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 ())  

before the first stage, after the first phase and after the second phase The same operation to check The contents of the used column:

  df.col.tolist () [: 5]  

I have seen that when the date is 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.

Can anyone explain this behavior?


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -