timedelta days to year pandas

Solutions on MaxInterview for timedelta days to year pandas by the best coders in the world

showing results for - "timedelta days to year pandas"
Ian
28 Nov 2016
1In[1]: import pandas as pd
2In[2]: df = pd.DataFrame([ pd.Timestamp('20150111'), 
3                           pd.Timestamp('20150301') ], columns=['date'])
4In[3]: df['today'] = pd.Timestamp('20150315')
5In[4]: df
6Out[4]: 
7        date      today
80 2015-01-11 2015-03-15
91 2015-03-01 2015-03-15
10
11In[5]: (df['today'] - df['date']).dt.days
12Out[5]: 
130    63
141    14
15dtype: int64
16
similar questions
queries leading to this page
timedelta days to year pandas