Skip to content

Fixed date_range to change dtype resolution #59055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
8 changes: 8 additions & 0 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,14 @@ def date_range(
"""
if freq is None and com.any_none(periods, start, end):
freq = "D"

if unit is None and freq is not None:
offset = to_offset(freq)
if offset is not None:
unit = offset.n

if unit is None:
unit = 'ns'

dtarr = DatetimeArray._generate_range(
start=start,
Expand Down
Loading