Skip to content

BUG: bug in pandas 3.0 with posixpath inside Series #63832

@vadimpy

Description

@vadimpy

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
from pathlib import Path

home = Path("~/").expanduser()
suff1 = pd.Series(["a", "b"])
suff2 = pd.Series(["c", "d"])
home / suff1 / suff2

>> ArrowInvalid: Could not convert PosixPath('.../a') with type PosixPath: did not recognize Python value type when inferring an Arrow data type

Issue Description

While home / suff1 and home / suff1 / suff2.astype('O') works correctly

Expected Behavior

Expected behaviour is the same as for the following code

import pandas as pd
from pathlib import Path

home = Path("~/").expanduser()
suff1 = pd.Series(["a", "b"])
suff2 = pd.Series(["c", "d"])
home / suff1 / suff2.astype('O')

Installed Versions

Details

INSTALLED VERSIONS

commit : 366ccdf
python : 3.12.9
python-bits : 64
OS : Linux
OS-release : 5.15.0-133-generic
Version : #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : C.UTF-8

pandas : 3.0.0
numpy : 2.1.3
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : 3.1.1
sphinx : None
IPython : 9.0.2
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.3
bottleneck : None
fastparquet : None
fsspec : 2025.3.0
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.6
lxml.etree : 5.3.1
matplotlib : 3.10.1
numba : 0.61.0
numexpr : 2.11.0
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : 19.0.1
pyiceberg : None
pyreadstat : None
pytest : None
python-calamine : None
pytz : 2025.2
pyxlsb : None
s3fs : 2025.3.0
scipy : 1.15.2
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
xlsxwriter : None
zstandard : 0.23.0
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityBugStringsString extension data type and string data

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions