diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 57cbc76d1c2fa..b95a290a43189 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -849,7 +849,7 @@ def date_range( tz : str or tzinfo, optional Time zone name for returning localized DatetimeIndex, for example 'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is - timezone-naive. + timezone-naive unless timezone-aware datetime-likes are passed. normalize : bool, default False Normalize start/end dates to midnight before generating date range. name : str, default None @@ -900,6 +900,18 @@ def date_range( '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'], dtype='datetime64[ns]', freq='D') + Specify timezone-aware `start` and `end`, with the default daily frequency. + + >>> pd.date_range( + ... start=pd.to_datetime("1/1/2018").tz_localize("Europe/Berlin"), + ... end=pd.to_datetime("1/08/2018").tz_localize("Europe/Berlin"), + ... ) + DatetimeIndex(['2018-01-01 00:00:00+01:00', '2018-01-02 00:00:00+01:00', + '2018-01-03 00:00:00+01:00', '2018-01-04 00:00:00+01:00', + '2018-01-05 00:00:00+01:00', '2018-01-06 00:00:00+01:00', + '2018-01-07 00:00:00+01:00', '2018-01-08 00:00:00+01:00'], + dtype='datetime64[ns, Europe/Berlin]', freq='D') + Specify `start` and `periods`, the number of periods (days). >>> pd.date_range(start='1/1/2018', periods=8)