Skip to content

Commit

Permalink
ignore pandas_metadata for string dtype in case of dictionary column
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Nov 13, 2024
1 parent fdd6af3 commit 84b8234
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/pyarrow/pandas_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,10 +878,14 @@ def _get_extension_dtypes(
# that are certainly numpy dtypes
pandas_dtype = _pandas_api.pandas_dtype(dtype)
if isinstance(pandas_dtype, _pandas_api.extension_dtype):
if (strings_to_categorical or name in categories) and isinstance(
pandas_dtype, _pandas_api.pd.StringDtype
):
continue
if isinstance(pandas_dtype, _pandas_api.pd.StringDtype):
if strings_to_categorical or name in categories:
continue
try:
if pa.types.is_dictionary(table.schema.field(name).type):
continue
except KeyError:
pass
if hasattr(pandas_dtype, "__from_arrow__"):
ext_columns[name] = pandas_dtype

Expand Down

0 comments on commit 84b8234

Please sign in to comment.