@@ -1964,11 +1964,41 @@ def date(self):
1964
1964
1965
1965
def normalize (self ):
1966
1966
"""
1967
- Return DatetimeIndex with times to midnight. Length is unaltered
1967
+ Convert times to midnight.
1968
+
1969
+ The time component of the date-timeise converted to midnight i.e.
1970
+ 00:00:00. This is useful in cases, when the time does not matter.
1971
+ Length is unaltered. The timezones are unaffected.
1972
+
1973
+ This method is available on Series with datetime values under
1974
+ the ``.dt`` accessor, and directly on DatetimeIndex.
1968
1975
1969
1976
Returns
1970
1977
-------
1971
- 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.
1981
+
1982
+ See Also
1983
+ --------
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.
1987
+
1988
+ Examples
1989
+ --------
1990
+ >>> idx = pd.DatetimeIndex(start='2014-08-01 10:00', freq='H',
1991
+ ... periods=3, tz='Asia/Calcutta')
1992
+ >>> idx
1993
+ DatetimeIndex(['2014-08-01 10:00:00+05:30',
1994
+ '2014-08-01 11:00:00+05:30',
1995
+ '2014-08-01 12:00:00+05:30'],
1996
+ dtype='datetime64[ns, Asia/Calcutta]', freq='H')
1997
+ >>> idx.normalize()
1998
+ DatetimeIndex(['2014-08-01 00:00:00+05:30',
1999
+ '2014-08-01 00:00:00+05:30',
2000
+ '2014-08-01 00:00:00+05:30'],
2001
+ dtype='datetime64[ns, Asia/Calcutta]', freq=None)
1972
2002
"""
1973
2003
new_values = conversion .date_normalize (self .asi8 , self .tz )
1974
2004
return DatetimeIndex (new_values , freq = 'infer' , name = self .name ,
0 commit comments