Skip to content

Bug: Resample removes timezone localization from Period.start_time #28039

Open
@ngehrsitz

Description

@ngehrsitz

Code Sample

from pytz import timezone
index = DatetimeIndex(['2019-01-01 06:00', '2019-01-01 07:00', '2019-01-01 08:00'], tz=timezone('Europe/Berlin'))
s = Series(index=index, data=[1, 2, 3])
print(s.index.tz)
rs = s.resample("3h", kind="period").sum()
for x in rs.index:
    print(x.start_time.tz)
    print(x.end_time.tz)

Problem description

All the Periods in the resampled PeriodIndex should have their start_time and end_time TimeStamps set with the correct Timezone.
Since the the DateTimeIndex was tz aware the attributes in the PeriodIndex should be too.
This is probably related to #13238 and #15777

Expected Output

Europe/Berlin
Europe/Berlin
Europe/Berlin

Tested Version

pandas 0.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError ReportingIncorrect or improved errors from pandasPeriodPeriod data typeResampleresample methodTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions