You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-45175: [Python] Honor the strings_to_categorical keyword in to_pandas for string view type (#45176)
### Rationale for this change
Currently this keyword works for string or large string:
```python
>>> table = pa.table({"col": pa.array(["a", "b", "a"], pa.string())})
>>> table.to_pandas(strings_to_categorical=True).dtypes
col category
dtype: object
>>> table = pa.table({"col": pa.array(["a", "b", "a"], pa.large_string())})
>>> table.to_pandas(strings_to_categorical=True).dtypes
col category
dtype: object
```
but not for string view:
```python
>>> table = pa.table({"col": pa.array(["a", "b", "a"], pa.string_view())})
>>> table.to_pandas(strings_to_categorical=True).dtypes
col object
dtype: object
```
For consistency we should make that keyword check for string view columns as well, I think
From https://github.com/apache/arrow/pull/44195/files#r1901831460
### Are these changes tested?
Yes
### Are there any user-facing changes?
Yes, when using the `strings_to_categorical=True` keyword and having a string_view type, this column will now be converted to a pandas Categorical
* GitHub Issue: #45175
Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
0 commit comments