@@ -1770,11 +1770,36 @@ def date(self):
1770
1770
1771
1771
def normalize (self ):
1772
1772
"""
1773
- Return DatetimeIndex with times to midnight. Length is unaltered
1773
+ Convert times to midnight.
1774
+
1775
+ When using DatetimeIndex, the time can be converted to midnight i.e.
1776
+ 00:00:00. This is useful in cases, when the time does not matter.
1777
+ Length is unaltered. The timezones are unaffected.
1774
1778
1775
1779
Returns
1776
1780
-------
1777
1781
normalized : DatetimeIndex
1782
+
1783
+ See Also
1784
+ --------
1785
+ DatetimeIndex.floor : Floor the DatetimeIndex to the specified freq.
1786
+ DatetimeIndex.ceil : Ceil the DatetimeIndex to the specified freq.
1787
+ DatetimeIndex.round : Round the DatetimeIndex to the specified freq.
1788
+
1789
+ Examples
1790
+ --------
1791
+ >>> df = pd.DatetimeIndex(start='2014-08-01 10:00', freq='H',
1792
+ ... periods=3, tz='Asia/Calcutta')
1793
+ >>> df
1794
+ DatetimeIndex(['2014-08-01 10:00:00+05:30',
1795
+ '2014-08-01 11:00:00+05:30',
1796
+ '2014-08-01 12:00:00+05:30'],
1797
+ dtype='datetime64[ns, Asia/Calcutta]', freq='H')
1798
+ >>> df.normalize()
1799
+ DatetimeIndex(['2014-08-01 00:00:00+05:30',
1800
+ '2014-08-01 00:00:00+05:30',
1801
+ '2014-08-01 00:00:00+05:30'],
1802
+ dtype='datetime64[ns, Asia/Calcutta]', freq=None)
1778
1803
"""
1779
1804
new_values = conversion .date_normalize (self .asi8 , self .tz )
1780
1805
return DatetimeIndex (new_values , freq = 'infer' , name = self .name ,
0 commit comments