-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support additional dtypes in resample
#9413
Conversation
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
Looks good! Can we add a test? |
pandas.BaseOffset, pandas.Timedelta, datetime.timedelta, and BaseCFTimeOffset are now all supported datatypes for resampling.
1e6cf96
to
36b8a63
Compare
9588cf4
to
1ed7c7f
Compare
9ec6d18
to
769e850
Compare
for more information, see https://pre-commit.ci
This is failing a test on the bare-minimum environment because of a FutureWarning caused by pandas 2.0.3 using 'S' instead of 's' for an internal frequency string. I noticed there are other FutureWarnings that occur during the test run but don't cause a test failure, why is this? Is it possible to do the same with my test? e.g. This warning does not cause a test failure.
|
yes we can take it from here. Thanks for your contribution and welcome to Xarray! |
Thanks! And thanks for creating such a welcoming atmosphere for new contributors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliverhiggs sorry for the delay—this looks great!
To answer your question about the warning leading to a test failure—a few months ago we made a change to make any new warnings emitted in the test suite errors (#8974). In that PR some code was added to ignore some existing warnings (the MultiIndex
warning you noted being one of them).
We've dealt with the frequency string deprecation warning in the past in the context of old pandas versions (#8627); I made a suggestion which I think may resolve it.
Co-authored-by: Spencer Clark <spencerkclark@gmail.com>
* main: (29 commits) Release notes for v2024.09.0 (pydata#9480) Fix `DataTree.coords.__setitem__` by adding `DataTreeCoordinates` class (pydata#9451) Rename DataTree's "ds" and "data" to "dataset" (pydata#9476) Update DataTree repr to indicate inheritance (pydata#9470) Bump pypa/gh-action-pypi-publish in the actions group (pydata#9460) Repo checker (pydata#9450) Add days_in_year and decimal_year to dt accessor (pydata#9105) remove parent argument from DataTree.__init__ (pydata#9465) Fix inheritance in DataTree.copy() (pydata#9457) Implement `DataTree.__delitem__` (pydata#9453) Add ASV for datatree.from_dict (pydata#9459) Make the first argument in DataTree.from_dict positional only (pydata#9446) Fix typos across the code, doc and comments (pydata#9443) DataTree should not be "Generic" (pydata#9445) Disallow passing a DataArray as data into the DataTree constructor (pydata#9444) Support additional dtypes in `resample` (pydata#9413) Shallow copy parent and children in DataTree constructor (pydata#9297) Bump minimum versions for dependencies (pydata#9434) Always include at least one category in random test data (pydata#9436) Avoid deep-copy when constructing groupby codes (pydata#9429) ...
* Support additional dtypes to resample pandas.BaseOffset, pandas.Timedelta, datetime.timedelta, and BaseCFTimeOffset are now all supported datatypes for resampling. * Update whats-new * Fix types * Add unit test * Fix test * Support more dtypes for CFTimeIndex resampling * Tidy resample type hints * Fix some mypy bugs * Fixes * Fix tests * WIP * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update doc/whats-new.rst * Apply suggestions from code review Co-authored-by: Spencer Clark <spencerkclark@gmail.com> * Fix mypy error * Fix bad edit --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> Co-authored-by: Spencer Clark <spencerkclark@gmail.com>
pandas.BaseOffset, pandas.Timedelta, datetime.timedelta, and BaseCFTimeOffset are now all supported datatypes for resampling.
Closes #9408