From 98537a47fee63328519f2dd25dfa5b3dfe2aa3ad Mon Sep 17 00:00:00 2001 From: Hori75 Date: Sat, 29 Feb 2020 12:53:08 +0700 Subject: [PATCH 1/4] DOC: Fix SS06 errors in pandas.DatetimeIndex --- pandas/core/indexes/datetimes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index c9fefd46e55c7..04ee6a35b2ed8 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -78,9 +78,10 @@ def _new_DatetimeIndex(cls, d): ) class DatetimeIndex(DatetimeTimedeltaMixin): """ - Immutable ndarray of datetime64 data, represented internally as int64, and - which can be boxed to Timestamp objects that are subclasses of datetime and - carry metadata such as frequency information. + Immutable ndarray of datetime64 data. + + Represented internally as int64, and which can be boxed to Timestamp objects + that are subclasses of datetime and carry metadata such as frequency information. Parameters ---------- From c37ba71da6d3d6c8227acb6b930445a7b1b7d181 Mon Sep 17 00:00:00 2001 From: Hori75 Date: Sat, 29 Feb 2020 13:07:44 +0700 Subject: [PATCH 2/4] DOC: fix PR01 error of pandas.DatetimeIndex --- pandas/core/indexes/datetimes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 04ee6a35b2ed8..a7d3f6f80d546 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -94,6 +94,7 @@ class DatetimeIndex(DatetimeTimedeltaMixin): 'infer' can be passed in order to set the frequency of the index as the inferred frequency upon creation. tz : pytz.timezone or dateutil.tz.tzfile + Timezone of the datetime. ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise' When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 From ebc01931ff7f0491318e8b0dbfbbaaf7f50116df Mon Sep 17 00:00:00 2001 From: Hori75 Date: Sat, 29 Feb 2020 13:32:51 +0700 Subject: [PATCH 3/4] DOC: Fix PR01 and reorder the parameter doc of panda.DatetimeIndex --- pandas/core/indexes/datetimes.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index a7d3f6f80d546..39e17c9592676 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -87,14 +87,17 @@ class DatetimeIndex(DatetimeTimedeltaMixin): ---------- data : array-like (1-dimensional), optional Optional datetime-like data to construct index with. - copy : bool - Make a copy of input ndarray. freq : str or pandas offset object, optional One of pandas date offset strings or corresponding objects. The string 'infer' can be passed in order to set the frequency of the index as the inferred frequency upon creation. tz : pytz.timezone or dateutil.tz.tzfile Timezone of the datetime. + normalize : bool, default False + Normalize start/end dates to midnight before generating date range. + closed : {'left', 'right'}, optional + Make the interval closed with respect to the given frequency to + the 'left', 'right', or both sides (None, the default). ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise' When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 @@ -109,12 +112,16 @@ class DatetimeIndex(DatetimeTimedeltaMixin): times) - 'NaT' will return NaT where there are ambiguous times - 'raise' will raise an AmbiguousTimeError if there are ambiguous times. - name : object - Name to be stored in the index. dayfirst : bool, default False If True, parse dates in `data` with the day first order. yearfirst : bool, default False If True parse dates in `data` with the year first order. + dtype : numpy.dtype or DatetimeTZDtype + Note that the only NumPy dtype allowed is ‘datetime64[ns]’. + copy : bool + Make a copy of input ndarray. + name : object + Name to be stored in the index. Attributes ---------- From f57e74548a50710fbae0a7b72b3b1074b35b089d Mon Sep 17 00:00:00 2001 From: Hori75 Date: Tue, 3 Mar 2020 12:30:26 +0700 Subject: [PATCH 4/4] DOC: Update pandas.DatetimeIndex docstring and parameters --- pandas/core/indexes/datetimes.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 39e17c9592676..46824e0be6c28 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -78,10 +78,10 @@ def _new_DatetimeIndex(cls, d): ) class DatetimeIndex(DatetimeTimedeltaMixin): """ - Immutable ndarray of datetime64 data. + Immutable ndarray-like of datetime64 data. Represented internally as int64, and which can be boxed to Timestamp objects - that are subclasses of datetime and carry metadata such as frequency information. + that are subclasses of datetime and carry metadata. Parameters ---------- @@ -91,13 +91,13 @@ class DatetimeIndex(DatetimeTimedeltaMixin): One of pandas date offset strings or corresponding objects. The string 'infer' can be passed in order to set the frequency of the index as the inferred frequency upon creation. - tz : pytz.timezone or dateutil.tz.tzfile - Timezone of the datetime. + tz : pytz.timezone or dateutil.tz.tzfile or datetime.tzinfo or str + Set the Timezone of the data. normalize : bool, default False Normalize start/end dates to midnight before generating date range. closed : {'left', 'right'}, optional - Make the interval closed with respect to the given frequency to - the 'left', 'right', or both sides (None, the default). + Set whether to include `start` and `end` that are on the + boundary. The default includes boundary points on either end. ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise' When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 @@ -116,11 +116,11 @@ class DatetimeIndex(DatetimeTimedeltaMixin): If True, parse dates in `data` with the day first order. yearfirst : bool, default False If True parse dates in `data` with the year first order. - dtype : numpy.dtype or DatetimeTZDtype + dtype : numpy.dtype or DatetimeTZDtype or str, default None Note that the only NumPy dtype allowed is ‘datetime64[ns]’. - copy : bool + copy : bool, default False Make a copy of input ndarray. - name : object + name : label, default None Name to be stored in the index. Attributes