Skip to content

Commit d7cd4f3

Browse files
committed
DOC: Clarify parameter rules in the Notes Section of date_range and imedelta_range
1 parent 37f0532 commit d7cd4f3

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
@@ -893,9 +893,11 @@ def date_range(
893893
Notes
894894
-----
895895
Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
896-
exactly three must be specified. If ``freq`` is omitted, the resulting
897-
``DatetimeIndex`` will have ``periods`` linearly spaced elements between
898-
``start`` and ``end`` (closed on both sides).
896+
a maximum of three can be specified at once. Of the three parameters
897+
``start``, ``end``, and ``periods``, at least two must be specified.
898+
If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have
899+
``periods`` linearly spaced elements between ``start`` and ``end``
900+
(closed on both sides).
899901
900902
To learn more about the frequency strings, please see
901903
: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
@@ -284,9 +284,11 @@ def timedelta_range(
284284
Notes
285285
-----
286286
Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
287-
exactly three must be specified. If ``freq`` is omitted, the resulting
288-
``TimedeltaIndex`` will have ``periods`` linearly spaced elements between
289-
``start`` and ``end`` (closed on both sides).
287+
a maximum of three can be specified at once. Of the three parameters
288+
``start``, ``end``, and ``periods``, at least two must be specified.
289+
If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have
290+
``periods`` linearly spaced elements between ``start`` and ``end``
291+
(closed on both sides).
290292
291293
To learn more about the frequency strings, please see
292294
:ref:`this link<timeseries.offset_aliases>`.

0 commit comments

Comments
 (0)