Skip to content

Conversation

@sinhrks
Copy link
Member

@sinhrks sinhrks commented Sep 7, 2015

Fixed 2 issues:

  • date_range can't handle negative calendar-based freq (like A, Q and M).
import pandas as pd

# OK
pd.date_range('2011-01-01', freq='-1D', periods=3)
# DatetimeIndex(['2011-01-01', '2010-12-31', '2010-12-30'], dtype='datetime64[ns]', freq='-1D')

# NG
pd.date_range('2011-01-01', freq='-1M', periods=3)
# DatetimeIndex([], dtype='datetime64[ns]', freq='-1M')
  • Unable to infer negative freq.
pd.DatetimeIndex(['2011-01-05', '2011-01-03', '2011-01-01'], freq='infer')
# DatetimeIndex(['2011-01-05', '2011-01-03', '2011-01-01'], dtype='datetime64[ns]', freq=None)

pd.TimedeltaIndex(['-1 days', '-3 days', '-5 days'], freq='infer')
# TimedeltaIndex(['-1 days', '-3 days', '-5 days'], dtype='timedelta64[ns]', freq=None)

@sinhrks sinhrks added Bug Frequency DateOffsets labels Sep 7, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone Sep 7, 2015
jreback added a commit that referenced this pull request Sep 7, 2015
BUG: Unable to infer negative freq
@jreback jreback merged commit 0b858f0 into pandas-dev:master Sep 7, 2015
@jreback
Copy link
Contributor

jreback commented Sep 7, 2015

thanks @sinhrks

@sinhrks sinhrks deleted the negative_freq branch September 7, 2015 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Frequency DateOffsets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants