79653567

Date: 2025-06-04 22:19:17
Score: 1
Natty:
Report link
import pandas as pd
import numpy as np

start_date = "2024-09-01"
end_date = "2025-04-30"

# date range with UK timezone (Europe/London)
date_range = pd.date_range(start=start_date, end=end_date, freq='h', tz='Europe/London')
dummy_data = np.zeros((len(date_range), 1))

df = pd.DataFrame(dummy_data, index=date_range)


# Sunday March 30th at 1am
print(df.resample('86400000ms').agg('sum').loc["2025-03-29": "2025-04-01"])
#                              0
# 2025-03-29 23:00:00+00:00  0.0
# 2025-03-31 00:00:00+01:00  0.0
# 2025-04-01 00:00:00+01:00  0.0
print( df.resample('1d').agg('sum').loc["2025-03-29": "2025-04-01"])
#                             0
# 2025-03-29 00:00:00+00:00  0.0
# 2025-03-30 00:00:00+00:00  0.0
# 2025-03-31 00:00:00+01:00  0.0
# 2025-04-01 00:00:00+01:00  0.0

Above is a minimal example to reproduce your problem. I believe the issue is with resampling by 86400000ms, which causes an error when skipping the DST transition on Sunday, March 30th at 1 a.m. Why not resample by '1d' instead?

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: zerdeshtjuan