Skip to content

Conversation

khemkaran10
Copy link
Contributor

start = pd.Timestamp("2024-04-26 01:00:00", tz="Africa/Cairo")
end = pd.Timestamp("2024-04-27 00:00:00", tz="Africa/Cairo")
tz = "Africa/Cairo"
freq = "D"

full_range = pd.date_range(
    start=start,
    end=end,
    freq=freq,
    tz=tz,
    nonexistent="shift_forward", 
    ambiguous=True, 
    normalize=True,
)

Before Fix ❌:

NonExistentTimeError: 2024-04-26 00:00:00

After Fix ✅:

DatetimeIndex(['2024-04-26 01:00:00+03:00'], dtype='datetime64[ns, Africa/Cairo]', freq='D')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: pandas.date_range() raises NonExistentTimeError despite nonexistent="shift_forward" when crossing DST boundaries

1 participant