Skip to content

Commit 60fdfc7

Browse files
Backport PR #45203: DOC: fix doctests for depr closed arg (#45270)
Co-authored-by: JHM Darbyshire <[email protected]>
1 parent 1d2a9cb commit 60fdfc7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pandas/core/indexes/datetimes.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1022,22 +1022,23 @@ def date_range(
10221022
'2018-01-05 00:00:00+09:00'],
10231023
dtype='datetime64[ns, Asia/Tokyo]', freq='D')
10241024
1025-
`closed` controls whether to include `start` and `end` that are on the
1026-
boundary. The default includes boundary points on either end.
1025+
`inclusive` controls whether to include `start` and `end` that are on the
1026+
boundary. The default, "both", includes boundary points on either end.
10271027
1028-
>>> pd.date_range(start='2017-01-01', end='2017-01-04', closed=None)
1028+
>>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive="both")
10291029
DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04'],
10301030
dtype='datetime64[ns]', freq='D')
10311031
1032-
Use ``closed='left'`` to exclude `end` if it falls on the boundary.
1032+
Use ``inclusive='left'`` to exclude `end` if it falls on the boundary.
10331033
1034-
>>> pd.date_range(start='2017-01-01', end='2017-01-04', closed='left')
1034+
>>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive='left')
10351035
DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03'],
10361036
dtype='datetime64[ns]', freq='D')
10371037
1038-
Use ``closed='right'`` to exclude `start` if it falls on the boundary.
1038+
Use ``inclusive='right'`` to exclude `start` if it falls on the boundary, and
1039+
similarly ``inclusive='neither'`` will exclude both `start` and `end`.
10391040
1040-
>>> pd.date_range(start='2017-01-01', end='2017-01-04', closed='right')
1041+
>>> pd.date_range(start='2017-01-01', end='2017-01-04', inclusive='right')
10411042
DatetimeIndex(['2017-01-02', '2017-01-03', '2017-01-04'],
10421043
dtype='datetime64[ns]', freq='D')
10431044
"""

0 commit comments

Comments
 (0)