Skip to content

Pandas 3.1: Use pd.offsets.BaseOffset instead of deprecated pd.DateOffset - #12711

Merged
crusaderky merged 1 commit into
dask:mainfrom
crusaderky:fix/pandas-dateoffset-isinstance
Nov 12, 2026
Merged

crusaderky merged 1 commit into
dask:mainfrom
crusaderky:fix/pandas-dateoffset-isinstance

Conversation

@crusaderky

@crusaderky crusaderky commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

pandas 3.1 deprecates isinstance(obj, pd.DateOffset) for objects that are not
direct DateOffset instances; it now emits Pandas4Warning and will return
False in a future version.

isinstance(x, pd.DateOffset) is deprecated in pandas 3.1 for offsets that
are not direct DateOffset instances and will return False in a future
version. Since 'filterwarnings = error' is configured, every shift with an
offset (Hour, Day, BusinessDay, ...) turned into a Pandas4Warning failure.
pd.offsets.BaseOffset is the documented replacement and every real offset
subclasses it, so behaviour is unchanged.
@crusaderky crusaderky changed the title [unsupervised AI] Use pd.offsets.BaseOffset instead of deprecated isinstance(x, pd.DateOffset) Pandas 3.1: Use pd.offsets.BaseOffset instead of deprecated pd.DateOffset Nov 12, 2026
@crusaderky
crusaderky marked this pull request as ready for review November 12, 2026 15:31
@crusaderky
crusaderky merged commit a415920 into dask:main Nov 12, 2026
32 of 34 checks passed
@crusaderky
crusaderky deleted the fix/pandas-dateoffset-isinstance branch November 12, 2026 15:31
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.

1 participant