pandas.datetime addition: What's wrong?
Paulo da Silva
p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Tue Jun 7 22:09:14 EDT 2016
Hi all!
What's wrong with this?
import pandas as pd
x=pd.to_datetime("20160501")
x+pd.DateOffset(days=1)
Timestamp('2016-05-02 00:00:00', tz=None)
x.__add__(pd.DateOffset(days=1))
NotImplemented
More generally I have a class derived from pandas.datetime and I want to
implement its own __add__ that at a given point call super __add__.
For example:
class C(pandas.datetime):
...
def __add__(self,n):
...
r=super(C,self).__add__(pd.DateOffset(days=n))
...
BTW, in the last line is it needed and how to "cast" self to
pandas.datetime?
Thanks for any help
More information about the Python-list
mailing list