Skip to content

BUG: Index name lost when using "resample" with pyarrow dtypes #61222

Closed
@mthiboust

Description

@mthiboust

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

# Create a df with DatetimeIndex called "timestamp" and native pandas dtype
native_df = pd.DataFrame(
    {'value': [23.5, 24.1, 22.8, 25.3, 23.9]},
    index=pd.date_range(start='2025-01-01 00:00:00', end='2025-01-01 04:00:00', freq='h'),
)
native_df.index.name = "timestamp"

# Create a similar df with pyarrow dtypes
pyarrow_df = native_df.copy()
pyarrow_df.index = pyarrow_df.index.astype('timestamp[ns][pyarrow]')
pyarrow_df["value"] = pyarrow_df["value"].astype('float64[pyarrow]')

native_df.resample("2h").mean().reset_index()["timestamp"] # OK
pyarrow_df.resample("2h").mean().reset_index()["timestamp"] # KeyError: 'timestamp'

Issue Description

The resample forget the name of the index when using pyarrow dtypes.

By the way, I notice that DatetimeIndex are converted to Index when using pyarrow dtypes. Maybe it is related?

See concrete example in screenshot
Image

Expected Behavior

The resample methods is expected to behave in the same way for pyarrow and native dtypes.

Installed Versions

INSTALLED VERSIONS

python : 3.12.8
python-bits : 64
OS : Linux
OS-release : 5.10.234-225.910.amzn2.x86_64
Version : #1 SMP Fri Feb 14 16:52:40 UTC 2025
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : C.UTF-8

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityBugResampleresample method

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions