Skip to content

[Python] Fix DeprecationWarnings in PyArrow tests #49255

Description

@AlenkaF

Describe the enhancement requested

I have stumbled upon this deprecation warning in test_pandas.py:

pyarrow/tests/test_pandas.py::TestConvertMisc::test_category
  /Users/alenkafrim/Repos/arrow/python/pyarrow/tests/test_pandas.py:3078: Pandas4Warning: Constructing a Categorical with a dtype and values containing non-null entries not in that dtype's categories is deprecated and will raise in a future version.
    'cat_strings_with_na': pd.Categorical(v1 * repeats,

pyarrow/tests/test_pandas.py::TestConvertMisc::test_category_implicit_from_pandas
  /Users/alenkafrim/Repos/arrow/python/pyarrow/tests/test_pandas.py:3104: Pandas4Warning: Constructing a Categorical with a dtype and values containing non-null entries not in that dtype's categories is deprecated and will raise in a future version.
    pd.Categorical(['a', 'b', 'c'], categories=['a', 'b']),

pyarrow/tests/test_pandas.py::TestConvertMisc::test_category_implicit_from_pandas
  /Users/alenkafrim/Repos/arrow/python/pyarrow/tests/test_pandas.py:3105: Pandas4Warning: Constructing a Categorical with a dtype and values containing non-null entries not in that dtype's categories is deprecated and will raise in a future version.
    pd.Categorical(['a', 'b', 'c'], categories=['a', 'b'],

There might be more we should address.

Component(s)

Python

Activity

  1. shashbha14 commented on Feb 12, 2026

    @shashbha14

    take

  2. IbrahimHassan-arch commented on Mar 23, 2026

    @IbrahimHassan-arch

    hello , This issue piqued my interest, And I would like to work on this issue. Can I get more information and guidance on this topic? I want to get familiar to the project. I am also participation in GSOC 2026 in the PyArrow improvements for astronomy project. Can I get some guidance to be familiar with codebase? @AlenkaF

  3. GujaLomsadze commented on Jul 18, 2026

    @GujaLomsadze
    Contributor

    PR 49271 addressing this looks stalled (no activity since March, changes requested by @AlenkaF unaddressed). I'd like to pick it up - taking AlenkaF's suggested approach: making the null explicit (['a','b',None]) instead of relying on the deprecated silent-drop, and dropping the redundant cat_strings_with_na. Will open a PR.

  4. added 2 commits that reference this issue on Jul 18, 2026
  5. added this to the 26.0.0 milestone on Jul 18, 2026
  6. rok commented on Jul 18, 2026

    @rok
    Member

    Issue resolved by pull request 50543
    #50543

  7. added a commit that references this issue on Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions