python - pandas timestamp subtraction -



python - pandas timestamp subtraction -

i have timestamp column this.

in [493]: df_data['last_seen'][:5] out[493]: 1 1838-10-31 01:36:32.493180416 2 1826-08-10 09:38:02.493180416 3 1839-05-04 21:14:42.493180416 4 1831-06-11 17:44:24.493180416 5 1820-01-26 10:32:07.493180416 name: last_seen

i want number of hours has passed since recent time stamp each row. write

df['last_seen'] = df['last_seen'] - df['last_seen'].max()

this throws error.

attributeerror: 'timestamp' object has no attribute 'dtype'

note when inquire :

>>> type(df['last_seen']) >>> pandas.core.series.series >>> type(df_data['last_seen'][1]) >>> pandas.tslib.timestamp

this bug

fixed in pr

https://github.com/pydata/pandas/pull/2899

python datetime pandas

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -