to_period is dropping timezone information · Issue #21333 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
localSeries = pd.date_range("2018-7-1", periods=1, freq="30T", tz="Europe/London") print(localSeries.to_period("30T")[0].start_time) #Timestamp('2018-07-01 00:00:00') print(localSeries.to_period("30T")[0].start_time.tz) #None print(localSeries.to_period("30T")[0].end_time.tz) #None print(localSeries[0].tz) #<DstTzInfo 'Europe/London' BST+1:00:00 DST>
While this may be useful for monthly/quarterly granularity data, it causes a problem for half-hourly data or similar around clock change, because the local times are used but the time-zone knowledge is dropped without warning.