Skip to content

BUG: AttributeError: 'ArrowStringArray' object has no attribute 'item' #63876

@khaeru

Description

@khaeru

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

# Pandas object that contains only 1 unique value:
s = pd.Series(["foo", "foo"])
s.unique()
# pandas 2.3.3:
# array(['foo'], dtype=object)
#
# pandas 3.0.0:
# <ArrowStringArray>
# ['foo']
# Length: 1, dtype: str

# Retrieve the unique value as a scalar
s.astype(object).unique().item()
# pandas 2.3.3 or 3.0.0: 'foo'

# Retrieve the unique value as a scalar
s.unique().item():
# pandas 2.3.3: 'foo'
# pandas 3.0.0: AttributeError: 'ArrowStringArray' object has no attribute 'item'

Issue Description

In pandas 2.3.3 and earlier (...).unique().item() worked as a way to get a single unique value that appeared in a Series —or DataFrame column, or as the result of other operation that resulted in a Series. This was concise and preferable to, for instance, (...).unique()[0] because it would raise an exception if earlier code produced a non-unique Series.

With pandas 3.0.0, when the dtype of the Series is str, the result of .unique() is ArrowStringArray, which lacks an .item() method.

If this is a deliberate breaking change, then I would expect that (a) it would be mentioned in the relevant section of the release notes; and/or (b) version < 3.0.0 would give some kind of DeprecationWarning to draw attention to expected breakage with the release of 3.0.0. As far as I can tell, neither of these happened.

Expected Behavior

The example above gives 'foo' on the last line with pandas 3.0.0—same as with pandas 2.3.3.

Installed Versions

Details
INSTALLED VERSIONS
------------------
commit                : 54caaaa40ceb677e1f521888da5715a88768bba5
python                : 3.14.0
python-bits           : 64
OS                    : Linux
OS-release            : 6.17.0-8-generic
Version               : #8-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 21:44:46 UTC 2025
machine               : x86_64
processor             : x86_64
byteorder             : little
LC_ALL                : None
LANG                  : en_CA.UTF-8
LOCALE                : en_CA.UTF-8

pandas                : 3.0.0+34.g54caaaa40c
numpy                 : 2.3.5
dateutil              : 2.9.0.post0
pip                   : None
Cython                : None
sphinx                : 8.2.3
IPython               : 9.6.0
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : 4.14.2
bottleneck            : 1.6.0
fastparquet           : 2024.11.0
fsspec                : 2025.9.0
html5lib              : None
hypothesis            : None
gcsfs                 : None
jinja2                : 3.1.6
lxml.etree            : 6.0.2
matplotlib            : 3.10.8
numba                 : 0.63.1
numexpr               : None
odfpy                 : None
openpyxl              : 3.1.5
psycopg2              : None
pymysql               : None
pyarrow               : 22.0.0
pyiceberg             : None
pyreadstat            : None
pytest                : 8.4.2
python-calamine       : None
pytz                  : 2025.2
pyxlsb                : 1.0.10
s3fs                  : None
scipy                 : 1.17.0
sqlalchemy            : 2.0.44
tables                : None
tabulate              : None
xarray                : 2025.12.0
xlrd                  : 2.0.2
xlsxwriter            : 3.2.9
zstandard             : None
qtpy                  : None
pyqt5                 : None

Metadata

Metadata

Assignees

No one assigned

    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