Skip to content

Commit 84aab8e

Browse files
make generic for index and series
1 parent 62a0455 commit 84aab8e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,30 +1966,35 @@ def normalize(self):
19661966
"""
19671967
Convert times to midnight.
19681968
1969-
When using DatetimeIndex, the time can be converted to midnight i.e.
1969+
The time component of the date-timeise converted to midnight i.e.
19701970
00:00:00. This is useful in cases, when the time does not matter.
19711971
Length is unaltered. The timezones are unaffected.
19721972
1973+
This method is available on Series with datetime values under
1974+
the ``.dt`` accessor, and directly on DatetimeIndex.
1975+
19731976
Returns
19741977
-------
1975-
normalized : DatetimeIndex
1978+
DatetimeIndex or Series
1979+
The same type as the original data. Series will have the same
1980+
name and index. DatetimeIndex will have the same name.
19761981
19771982
See Also
19781983
--------
1979-
DatetimeIndex.floor : Floor the DatetimeIndex to the specified freq.
1980-
DatetimeIndex.ceil : Ceil the DatetimeIndex to the specified freq.
1981-
DatetimeIndex.round : Round the DatetimeIndex to the specified freq.
1984+
floor : Floor the datetimes to the specified freq.
1985+
ceil : Ceil the datetimes to the specified freq.
1986+
round : Round the datetimes to the specified freq.
19821987
19831988
Examples
19841989
--------
1985-
>>> df = pd.DatetimeIndex(start='2014-08-01 10:00', freq='H',
1986-
... periods=3, tz='Asia/Calcutta')
1987-
>>> df
1990+
>>> idx = pd.DatetimeIndex(start='2014-08-01 10:00', freq='H',
1991+
... periods=3, tz='Asia/Calcutta')
1992+
>>> idx
19881993
DatetimeIndex(['2014-08-01 10:00:00+05:30',
19891994
'2014-08-01 11:00:00+05:30',
19901995
'2014-08-01 12:00:00+05:30'],
19911996
dtype='datetime64[ns, Asia/Calcutta]', freq='H')
1992-
>>> df.normalize()
1997+
>>> idx.normalize()
19931998
DatetimeIndex(['2014-08-01 00:00:00+05:30',
19941999
'2014-08-01 00:00:00+05:30',
19952000
'2014-08-01 00:00:00+05:30'],

0 commit comments

Comments
 (0)