Skip to content

Change defaults for resample #2363

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
changhiskhan opened this issue Nov 26, 2012 · 7 comments
Closed

Change defaults for resample #2363

changhiskhan opened this issue Nov 26, 2012 · 7 comments
Labels
Datetime Datetime data dtype
Milestone

Comments

@changhiskhan
Copy link
Contributor

maybe change closed and label both to 'left' to avoid confusion.

@wesm
Copy link
Member

wesm commented Nov 26, 2012

Urgh begrudgingly I agree this might be a good idea. Resampling to daily is a pretty big use case and the "right" way to do that is ts.resample('D', closed='left', label='left'). Maybe better to break code now vs. later. Ugh

@changhiskhan
Copy link
Contributor Author

maybe the right solution is closed=None, label=None and set it to 'right' if resampling to 'M', 'A', 'Q', 'BM', 'BA', 'BQ', 'W' (where the dates are the ending dates) and 'left' for others?

@changhiskhan
Copy link
Contributor Author

@wesm what do you think of the API change?
It's not too much magic to automatically infer the interval / label is it?

If we're happy with this I'll add some more tests.

@wesm
Copy link
Member

wesm commented Dec 2, 2012

I was thinking about it, and it seems D is really the only frequency that causes major confusion/problems, no?

@changhiskhan
Copy link
Contributor Author

I think anything where the time stamp is the beginning of the period should have closed left and label left.
For example, resampling S to H, HH:59:59 should be the right bin edge.

@wesm
Copy link
Member

wesm commented Dec 2, 2012

Yeah, that's a fair point. Guess I should start a page on the website with "what's changed/broken in pandas since Python for Data Analysis was published" =|

@changhiskhan
Copy link
Contributor Author

Or maybe even take all the book example code and maintain it as part of the pandas website?

wesm added a commit that referenced this issue Dec 7, 2012
* chang/resample-interval:
  TST: more tests for resample closed and label inference
  API: change resample to infer correct closed and label value by default #2363
@wesm wesm closed this as completed Dec 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype
Projects
None yet
Development

No branches or pull requests

2 participants