I need a datetime column in seconds, everywhere (including the docs) is saying that I should use Series.dt.total_seconds()
but it can't find the function. I'm assuming I have the wrong version of something but I don't...
pip freeze | grep pandas
pandas==0.20.3
python --version
Python 3.5.3
This is all within a virtualenv that has worked without fault for a long time, and the other Series.dt
functions work. Here's the code:
from pandas import Series
from datetime import datetime
s = Series([datetime.now() for _ in range(10)])
0 2017-08-25 15:55:25.079495
1 2017-08-25 15:55:25.079504
2 2017-08-25 15:55:25.079506
3 2017-08-25 15:55:25.079508
4 2017-08-25 15:55:25.079509
5 2017-08-25 15:55:25.079510
6 2017-08-25 15:55:25.079512
7 2017-08-25 15:55:25.079513
8 2017-08-25 15:55:25.079514
9 2017-08-25 15:55:25.079516
dtype: datetime64[ns]
s.dt
<pandas.core.indexes.accessors.DatetimeProperties object at 0x7f5a686507b8>
s.dt.minute
0 55
1 55
2 55
3 55
4 55
5 55
6 55
7 55
8 55
9 55
dtype: int64
s.dt.total_seconds()
AttributeError: 'DatetimeProperties' object has no attribute 'total_seconds'
I've also tested this on a second machine and get the same result. Any ideas what I'm missing?