Skip to content

Holidays Offset not Returning Correct Date #10217

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
robbyki opened this issue May 27, 2015 · 4 comments
Closed

Holidays Offset not Returning Correct Date #10217

robbyki opened this issue May 27, 2015 · 4 comments
Labels
Error Reporting Incorrect or improved errors from pandas
Milestone

Comments

@robbyki
Copy link

robbyki commented May 27, 2015

Why would the below return 11/2/2015 as opposed to 11/30/2015 if 11/30 would be considered the next Monday from the 4th Saturday?

Holiday("Cyber Monday", month=11, day=1, offset=pd.DateOffset(weekday=SA(4)), observance=next_monday)
@rockg
Copy link
Contributor

rockg commented May 27, 2015

This is currently an unsupported case. Right now you cannot combine both offset and observance (if you have observance, it only uses that). It was not necessary to support both arguments to accommodate the standard holidays. Nevertheless should be an easy extension in Holiday._apply_rule. However, you can apply multiple date offsets, so for your specific case do:

h = Holiday("Cyber Monday", month=11, day=1, 
offset=[pd.DateOffset(weekday=SA(4)), pd.DateOffset(2)])
>>> h.dates(datetime(2015, 11, 1), datetime(2015, 11, 30))
[Timestamp('2015-11-30 00:00:00')]

@jreback
Copy link
Contributor

jreback commented May 27, 2015

hmm, @rockg prob should raise NotImplementedError for this case (for now)?

@jreback jreback added Difficulty Novice Error Reporting Incorrect or improved errors from pandas labels May 27, 2015
@jreback jreback added this to the 0.17.0 milestone May 27, 2015
@rockg
Copy link
Contributor

rockg commented May 27, 2015

Agree that this should be caught.

@jreback
Copy link
Contributor

jreback commented Jun 1, 2015

closed by #10226

@jreback jreback closed this as completed Jun 1, 2015
@jorisvandenbossche jorisvandenbossche modified the milestones: 0.17.0, 0.16.2 Jun 2, 2015
cgevans added a commit to cgevans/pandas that referenced this issue Jun 5, 2015
* https://github.com/pydata/pandas: (26 commits)
  disable some deps on 3.2 build
  Fix meantim typo
  DOC: use current ipython in doc build
  PERF: write basic datetimes faster pandas-dev#10271
  TST: fix for bottleneck >= 1.0 nansum behavior, xref pandas-dev#9422
  add numba example to enhancingperf.rst
  BUG: SparseSeries constructor ignores input data name
  BUG: Raise TypeError only if key DataFrame is not empty pandas-dev#10126
  ENH: groupby.apply for Categorical should preserve categories (closes pandas-dev#10138)
  DOC: add in whatsnew/0.17.0.txt
  DOC: move whatsnew from 0.17.0 -> 0.16.2
  BUG:  Holiday(..) with both offset and observance raises NotImplementedError pandas-dev#10217
  BUG: Index.union cannot handle array-likes
  BUG: SparseSeries.abs() resets name
  BUG: Series arithmetic methods incorrectly hold name
  ENH: Don't infer WOM-5MON if we don't support it (pandas-dev#9425)
  BUG: Series.align resets name when fill_value is specified
  BUG: GroupBy.get_group raises ValueError when group key contains NaT
  Close mysql connection in TestXMySQL to prevent tests freezing
  BUG: plot doesnt default to matplotlib axes.grid setting (pandas-dev#9792)
  ...
yarikoptic added a commit to neurodebian/pandas that referenced this issue Jul 2, 2015
* commit 'v0.16.1-97-gbc7d48f': (56 commits)
  disable some deps on 3.2 build
  Fix meantim typo
  DOC: use current ipython in doc build
  PERF: write basic datetimes faster pandas-dev#10271
  TST: fix for bottleneck >= 1.0 nansum behavior, xref pandas-dev#9422
  add numba example to enhancingperf.rst
  BUG: SparseSeries constructor ignores input data name
  BUG: Raise TypeError only if key DataFrame is not empty pandas-dev#10126
  ENH: groupby.apply for Categorical should preserve categories (closes pandas-dev#10138)
  DOC: add in whatsnew/0.17.0.txt
  DOC: move whatsnew from 0.17.0 -> 0.16.2
  BUG:  Holiday(..) with both offset and observance raises NotImplementedError pandas-dev#10217
  BUG: Index.union cannot handle array-likes
  BUG: SparseSeries.abs() resets name
  BUG: Series arithmetic methods incorrectly hold name
  ENH: Don't infer WOM-5MON if we don't support it (pandas-dev#9425)
  BUG: Series.align resets name when fill_value is specified
  BUG: GroupBy.get_group raises ValueError when group key contains NaT
  Close mysql connection in TestXMySQL to prevent tests freezing
  BUG: plot doesnt default to matplotlib axes.grid setting (pandas-dev#9792)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants