Skip to content

Commit 1fa95a1

Browse files
authored
DOC: Clarify parameter rules in the Notes Section of date_range and timedelta_range (#62194)
1 parent 29ce489 commit 1fa95a1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,11 @@ def date_range(
906906
Notes
907907
-----
908908
Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
909-
exactly three must be specified. If ``freq`` is omitted, the resulting
910-
``DatetimeIndex`` will have ``periods`` linearly spaced elements between
911-
``start`` and ``end`` (closed on both sides).
909+
a maximum of three can be specified at once. Of the three parameters
910+
``start``, ``end``, and ``periods``, at least two must be specified.
911+
If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have
912+
``periods`` linearly spaced elements between ``start`` and ``end``
913+
(closed on both sides).
912914
913915
To learn more about the frequency strings, please see
914916
:ref:`this link<timeseries.offset_aliases>`.

pandas/core/indexes/timedeltas.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,11 @@ def timedelta_range(
287287
Notes
288288
-----
289289
Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
290-
exactly three must be specified. If ``freq`` is omitted, the resulting
291-
``TimedeltaIndex`` will have ``periods`` linearly spaced elements between
292-
``start`` and ``end`` (closed on both sides).
290+
a maximum of three can be specified at once. Of the three parameters
291+
``start``, ``end``, and ``periods``, at least two must be specified.
292+
If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have
293+
``periods`` linearly spaced elements between ``start`` and ``end``
294+
(closed on both sides).
293295
294296
To learn more about the frequency strings, please see
295297
:ref:`this link<timeseries.offset_aliases>`.

0 commit comments

Comments
 (0)