Skip to content

Fix pandas 3.1 compatibility in dtype inference - #1978

Open
Code-ve wants to merge 1 commit into
evidentlyai:mainfrom
Code-ve:fix/pandas-compatibility
Open

Code-ve wants to merge 1 commit into
evidentlyai:mainfrom
Code-ve:fix/pandas-compatibility

Conversation

@Code-ve

@Code-ve Code-ve commented Oct 28, 2026

Copy link
Copy Markdown

Summary

Fixes #1974.

The import of evidently fails with pandas 3.1.0 because infer_dtype_from_object, an internal pandas utility, is no longer available.

This change removes the dependency on that private API and introduces a local dtype-inference helper based on pandas.api.types.pandas_dtype and NumPy dtype handling. The existing TestColumnsType logic now uses this helper at both dtype-inference call sites.

Implementation

  • Replaces the import of the removed pandas.core.dtypes.common.infer_dtype_from_object utility.
  • Adds _infer_dtype_type to handle supported dtype representations, including NumPy types, pandas extension dtypes, and string aliases.
  • Updates both expected and actual column-type inference paths to use the helper.

Validation

  • Tests: 36 passed across the data-integrity and test-suite test modules.
  • Diff validation: git diff --check passed.
  • Lint and formatting: Ruff checks passed locally.

Scope

The change is limited to dtype inference in data_integrity_tests.py and does not intentionally alter the surrounding test behavior.

@Code-ve
Code-ve marked this pull request as draft October 28, 2026 16:55
@Code-ve
Code-ve marked this pull request as ready for review October 28, 2026 16:56
@Code-ve

Code-ve commented Oct 31, 2026

Copy link
Copy Markdown
Author

Hi @ptimizeroracle,

Just following up on this PR. The changes and relevant tests are ready from my side. Whenever someone gets a chance, I'd appreciate a review and any feedback.

Thank you!

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.

import evidently fails with pandas 3.1.0: infer_dtype_from_object was removed

1 participant