|
29 | 29 | cache_readonly,
|
30 | 30 | doc,
|
31 | 31 | )
|
| 32 | +from pandas.util._exceptions import find_stack_level |
32 | 33 |
|
33 | 34 | from pandas.core.dtypes.common import (
|
34 | 35 | is_datetime64_dtype,
|
@@ -152,9 +153,15 @@ class DatetimeIndex(DatetimeTimedeltaMixin):
|
152 | 153 | Set the Timezone of the data.
|
153 | 154 | normalize : bool, default False
|
154 | 155 | Normalize start/end dates to midnight before generating date range.
|
| 156 | +
|
| 157 | + .. deprecated:: 2.1.0 |
| 158 | +
|
155 | 159 | closed : {'left', 'right'}, optional
|
156 | 160 | Set whether to include `start` and `end` that are on the
|
157 | 161 | boundary. The default includes boundary points on either end.
|
| 162 | +
|
| 163 | + .. deprecated:: 2.1.0 |
| 164 | +
|
158 | 165 | ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
|
159 | 166 | When clocks moved backward due to DST, ambiguous times may arise.
|
160 | 167 | For example in Central European Time (UTC+01), when going from 03:00
|
@@ -310,15 +317,32 @@ def __new__(
|
310 | 317 | data=None,
|
311 | 318 | freq: Frequency | lib.NoDefault = lib.no_default,
|
312 | 319 | tz=lib.no_default,
|
313 |
| - normalize: bool = False, |
314 |
| - closed=None, |
| 320 | + normalize: bool | lib.NoDefault = lib.no_default, |
| 321 | + closed=lib.no_default, |
315 | 322 | ambiguous: TimeAmbiguous = "raise",
|
316 | 323 | dayfirst: bool = False,
|
317 | 324 | yearfirst: bool = False,
|
318 | 325 | dtype: Dtype | None = None,
|
319 | 326 | copy: bool = False,
|
320 | 327 | name: Hashable = None,
|
321 | 328 | ) -> Self:
|
| 329 | + if closed is not lib.no_default: |
| 330 | + # GH#52628 |
| 331 | + warnings.warn( |
| 332 | + f"The 'closed' keyword in {cls.__name__} construction is " |
| 333 | + "deprecated and will be removed in a future version.", |
| 334 | + FutureWarning, |
| 335 | + stacklevel=find_stack_level(), |
| 336 | + ) |
| 337 | + if normalize is not lib.no_default: |
| 338 | + # GH#52628 |
| 339 | + warnings.warn( |
| 340 | + f"The 'normalize' keyword in {cls.__name__} construction is " |
| 341 | + "deprecated and will be removed in a future version.", |
| 342 | + FutureWarning, |
| 343 | + stacklevel=find_stack_level(), |
| 344 | + ) |
| 345 | + |
322 | 346 | if is_scalar(data):
|
323 | 347 | cls._raise_scalar_data_error(data)
|
324 | 348 |
|
|
0 commit comments