@@ -6717,25 +6717,26 @@ def at_time(self, time, asof=False):
6717
6717
6718
6718
Examples
6719
6719
--------
6720
- >>> i = pd.date_range('2018-04-09', periods=4, freq='4D2min ')
6720
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='12H ')
6721
6721
>>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6722
6722
>>> ts
6723
6723
A
6724
- date
6725
6724
2018-04-09 00:00:00 1
6726
- 2018-04-13 00:02 :00 2
6727
- 2018-04-17 00:04 :00 3
6728
- 2018-04-21 00:06 :00 4
6729
- >>> ts.at_time('0:02 ')
6725
+ 2018-04-09 12:00 :00 2
6726
+ 2018-04-10 00:00 :00 3
6727
+ 2018-04-10 12:00 :00 4
6728
+ >>> ts.at_time('12:00 ')
6730
6729
A
6731
- date
6732
- 2018-04-13 00:02: 00 2
6730
+ 2018-04-09 12:00:00 2
6731
+ 2018-04-10 12: 00:00 4
6733
6732
6734
6733
See Also
6735
6734
--------
6736
6735
between_time : Select values between particular times of the day
6737
6736
first : Select initial periods of time series based on a date offset
6738
6737
last : Select final periods of time series based on a date offset
6738
+ DatetimeIndex.indexer_at_time : Get just the index positions for
6739
+ values at particular time of the day
6739
6740
"""
6740
6741
try :
6741
6742
indexer = self .index .indexer_at_time (time , asof = asof )
@@ -6748,6 +6749,9 @@ def between_time(self, start_time, end_time, include_start=True,
6748
6749
"""
6749
6750
Select values between particular times of the day (e.g., 9:00-9:30 AM).
6750
6751
6752
+ By setting ``start_time`` to be later than ``end_time``,
6753
+ you can get the times that are *not* between the two times.
6754
+
6751
6755
Notes
6752
6756
-----
6753
6757
For this method to work, the index must to be a :class:`DatetimeIndex`
@@ -6765,24 +6769,35 @@ def between_time(self, start_time, end_time, include_start=True,
6765
6769
6766
6770
Examples
6767
6771
--------
6768
- >>> i = pd.date_range('2018-04-09', periods=4, freq='2min ')
6772
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='1D20min ')
6769
6773
>>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6770
6774
>>> ts
6771
6775
A
6772
6776
2018-04-09 00:00:00 1
6773
- 2018-04-09 00:02:00 2
6774
- 2018-04-09 00:04:00 3
6775
- 2018-04-09 00:06:00 4
6776
- >>> ts.between_time('0:02', '0:04')
6777
+ 2018-04-10 00:20:00 2
6778
+ 2018-04-11 00:40:00 3
6779
+ 2018-04-12 01:00:00 4
6780
+
6781
+ >>> ts.between_time('0:15', '0:45')
6782
+ A
6783
+ 2018-04-10 00:20:00 2
6784
+ 2018-04-11 00:40:00 3
6785
+
6786
+ You get the times that are *not* between two times by setting
6787
+ ``start_time`` later than ``end_time``:
6788
+
6789
+ >>> ts.between_time('0:45', '0:15')
6777
6790
A
6778
- 2018-04-09 00:02 :00 2
6779
- 2018-04-09 00:04: 00 3
6791
+ 2018-04-09 00:00 :00 1
6792
+ 2018-04-12 01: 00:00 4
6780
6793
6781
6794
See Also
6782
6795
--------
6783
6796
at_time : Select values at a particular time of the day
6784
6797
first : Select initial periods of time series based on a date offset
6785
6798
last : Select final periods of time series based on a date offset
6799
+ DatetimeIndex.indexer_between_time : Get just the index positions for
6800
+ values between particular times of the day
6786
6801
"""
6787
6802
try :
6788
6803
indexer = self .index .indexer_between_time (
0 commit comments