From d7cd4f3c48b3ec7ff4bce5b2526db643eede04a5 Mon Sep 17 00:00:00 2001 From: Mazhar Abbas Date: Tue, 26 Aug 2025 00:10:40 +0200 Subject: [PATCH] DOC: Clarify parameter rules in the Notes Section of date_range and imedelta_range --- pandas/core/indexes/datetimes.py | 8 +++++--- pandas/core/indexes/timedeltas.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index ce6ea1ed980dd..c264313415fcf 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -893,9 +893,11 @@ def date_range( Notes ----- Of the four parameters ``start``, ``end``, ``periods``, and ``freq``, - exactly three must be specified. If ``freq`` is omitted, the resulting - ``DatetimeIndex`` will have ``periods`` linearly spaced elements between - ``start`` and ``end`` (closed on both sides). + a maximum of three can be specified at once. Of the three parameters + ``start``, ``end``, and ``periods``, at least two must be specified. + If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have + ``periods`` linearly spaced elements between ``start`` and ``end`` + (closed on both sides). To learn more about the frequency strings, please see :ref:`this link`. diff --git a/pandas/core/indexes/timedeltas.py b/pandas/core/indexes/timedeltas.py index fa3de46621643..b389b2ebe1db5 100644 --- a/pandas/core/indexes/timedeltas.py +++ b/pandas/core/indexes/timedeltas.py @@ -284,9 +284,11 @@ def timedelta_range( Notes ----- Of the four parameters ``start``, ``end``, ``periods``, and ``freq``, - exactly three must be specified. If ``freq`` is omitted, the resulting - ``TimedeltaIndex`` will have ``periods`` linearly spaced elements between - ``start`` and ``end`` (closed on both sides). + a maximum of three can be specified at once. Of the three parameters + ``start``, ``end``, and ``periods``, at least two must be specified. + If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have + ``periods`` linearly spaced elements between ``start`` and ``end`` + (closed on both sides). To learn more about the frequency strings, please see :ref:`this link`.