Pandas series of datetimes in python -
I have a series that is purely datetimes. Call it at chain 1
.
How can I remove the series from the series in the most effective way to create a new series of months only?
For example.
series1.month
does not work. But for every line, it will work
In panda version 0.14 and older, you apply Can
date to date
value:
chain 1 .apply (Lambda x: x.month)
to remove In0.15, a new
datetime
series accessor simplifies the operation (thanks @ crisb):series1.dt.month
here is one.
Comments
Post a Comment