Skip to content

BUG: Passing string[pyarrow] to the dtype parameter of e.g. csv_read() does produce a string type Series  #61496

Open
@ClauPet

Description

@ClauPet

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

df = pd.read_csv("test.csv", dtype_backend = "pyarrow", dtype={"col2":"string[pyarrow]"})

df
  col1 col2
0  abc    1
1  dfg    2

df.dtypes
col1    string[pyarrow]
col2    string[pyarrow]
dtype: object

# Series of col1 shows string[pyarrow] dtype
df["col1"]
0    abc
1    dfg
Name: col1, dtype: string[pyarrow]

# Seris of col2 does NOT show string[pyarrow], but string dtype
df["col2"]
0    1
1    2
Name: col2, dtype: string

# Using ArrowDtype instead of string alias with the dtype parameter of read_csv() correctly shows string[pyarrow] as the dtype of the Series consisting of col2
df1 = pd.read_csv("test.csv", dtype_backend = "pyarrow", dtype={"col2": pd.ArrowDtype(pyarrow.string())})

df1["col2"]
0    1
1    2
Name: col2, dtype: string[pyarrow]

Issue Description

When reading a CSV with dtype_backend="pyarrow" and specifying a column as "string[pyarrow]" via the dtype parameter, the resulting Series displays as dtype: string instead of the expected string[pyarrow], even though df.dtypes shows string[pyarrow]. This inconsistency only occurs when using the string alias — using pd.ArrowDtype(pyarrow.string()) correctly preserves and displays the Arrow-backed string[pyarrow] dtype in the Series.

Expected Behavior

df1["col2"]
0 1
1 2
Name: col2, dtype: string[pyarrow]

Installed Versions

INSTALLED VERSIONS

commit : 0691c5c
python : 3.11.10
python-bits : 64
OS : Linux
OS-release : 5.15.167.4-microsoft-standard-WSL2
Version : #1 SMP Tue Nov 5 00:21:55 UTC 2024
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.2.3
numpy : 2.2.6
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : 9.2.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.5
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 20.0.0
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

Labels

BugNeeds TriageIssue that has not been reviewed by a pandas team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions