Reputation: 9805
Is it normal that the following would return True
?
What would be the idea behind that ?
import pandas as pd
t = pd.Timestamp('2017-01-01 00:00:00')
t + pd.DateOffset(month=1) == t
Upvotes: 2
Views: 1754
Reputation: 862851
Use months
instead month
for add value 1
, not replace, thank you @splash58:
print (t + pd.DateOffset(months=1) == t)
False
Details:
print (t + pd.DateOffset(month=1))
2017-01-01 00:00:00
print (t + pd.DateOffset(months=1))
2017-02-01 00:00:00
If check pandas.tseries.offsets.DateOffset.html
:
**kwds
Temporal parameter that add to or replace the offset value.
Parameters that add to the offset (like Timedelta):
years
months
weeks
days
hours
minutes
seconds
microseconds
nanoseconds
Parameters that replace the offset value:
year
month
day
weekday
hour
minute
second
microsecond
nanosecond
Upvotes: 3