Skip to content

Linear interpolation fails on tz-aware Series #25508

Closed
@xoolive

Description

@xoolive

The following code fails on 0.24.1, doesn't fail on 0.23.4 but result was wrong.

from datetime import datetime, timezone, timedelta

start = datetime(2019, 1, 1, tzinfo=timezone.utc)

df = pd.DataFrame.from_records(
    {
        "date": [start + timedelta(days=i) for i in range(5)],
        "value": list(range(5)),
        "ref_date": [start + timedelta(days=i) for i in range(5)],
    }
)

df.set_index("date").resample("1H").interpolate("linear")

Things work again if:

  • one makes start tz-naive;
  • one removes column ref_date.

Metadata

Metadata

Assignees

Labels

BugDatetimeDatetime data dtypeExtensionArrayExtending pandas with custom dtypes or arrays.Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions