Skip to content

FIX-#7697: Use "start" as the default for convention in resample - #7714

Open
bhaskargurram-ai wants to merge 1 commit into
modin-project:mainfrom
bhaskargurram-ai:fix-7697-resample-convention
Open

bhaskargurram-ai wants to merge 1 commit into
modin-project:mainfrom
bhaskargurram-ai:fix-7697-resample-convention

Conversation

@bhaskargurram-ai

Copy link
Copy Markdown

What do these changes do?

pandas 2.3.3 (pandas-dev/pandas#62480) reverted the deprecation of the convention keyword of resample: its default is "start" again and the value is passed straight to TimeGrouper, which validates it. Modin's BasePandasDataset.resample defaulted convention to lib.no_default and forwarded that sentinel in resample_kwargs to df.resample(**resample_kwargs) (both in the default-to-pandas path and in the partition map_func), so on pandas 2.3.3 every resample aggregation failed with ValueError: Unsupported value _NoDefault.no_default for convention``.

This makes "start" the default, matching pandas 2.3.3 (and pandas 3.0), and removes the now unneeded lib.no_default translation in Resampler._get_groups. With pandas 2.2.x the behavior is unchanged (no_default was mapped to "start" there) and no warning surfaces from Modin; the only difference is that test_api.py's signature-default comparison for resample now matches 2.3.3 instead of 2.2.x.

Adds a regression test that resamples a Series on the current engine and under Backend="Pandas" and compares with pandas. The existing resample tests in test_series.py and dataframe/test_default.py fail on main with pandas 2.3.3 and pass with this change, as do test_dataframe_api_equality / test_series_api_equality.

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves BUG: Resample.mean() raises error on pandas 2.3.3 with native execution #7697
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

…n `resample`

pandas 2.3.3 (pandas-dev/pandas#62480) reverted the deprecation of the
`convention` keyword, so `DataFrame.resample`/`Series.resample` default
it to "start" again and `TimeGrouper` validates the value it receives.
Modin forwarded its own `lib.no_default` sentinel, which pandas now
rejects with `ValueError: Unsupported value _NoDefault.no_default for
`convention``, so every resample aggregation failed.

Default `convention` to "start" like pandas, and drop the now unneeded
`lib.no_default` translation in `Resampler._get_groups`.

Signed-off-by: Bhaskar Gurram <gurrambhaskar.ai@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Resample.mean() raises error on pandas 2.3.3 with native execution

1 participant