Skip to content

DateOffsets should allow element-wise addition to Series #10699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorisvandenbossche opened this issue Jul 29, 2015 · 2 comments
Closed

DateOffsets should allow element-wise addition to Series #10699

jorisvandenbossche opened this issue Jul 29, 2015 · 2 comments
Labels
Datetime Datetime data dtype Frequency DateOffsets
Milestone

Comments

@jorisvandenbossche
Copy link
Member

Adding a DateOffset works for single Timestamps and for DatetimeIndex, but fails on a Series:

In [132]: s = pd.Series(pd.date_range('2012-01-01', periods=3))

In [133]: s
Out[133]:
0   2012-01-01
1   2012-01-02
2   2012-01-03
dtype: datetime64[ns]

In [134]: s[0] + pd.DateOffset(months=2)
Out[134]: Timestamp('2012-03-01 00:00:00')

In [135]: pd.DatetimeIndex(s) + pd.DateOffset(months=2)
Out[135]: DatetimeIndex(['2012-03-01', '2012-03-02', '2012-03-03'], dtype='datetime64[ns]', freq='D', tz=None)

In [136]: s + pd.DateOffset(months=2)
---------------------------------------------------------------------------
TypeError: cannot use a non-absolute DateOffset in datetime/timedelta operations
 [<DateOffset: kwds={'months': 2}>]
@jorisvandenbossche jorisvandenbossche added Datetime Datetime data dtype Frequency DateOffsets labels Jul 29, 2015
@sinhrks
Copy link
Member

sinhrks commented Jul 30, 2015

+1. Also it's nice if other offset methods like onOffset can accept list-likes.

@jreback
Copy link
Contributor

jreback commented Aug 13, 2015

closed by #10744

@jreback jreback closed this as completed Aug 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Frequency DateOffsets
Projects
None yet
Development

No branches or pull requests

3 participants