@@ -6703,9 +6703,10 @@ def at_time(self, time, asof=False):
67036703 """
67046704 Select values at particular time of day (e.g. 9:30AM).
67056705
6706- Notes
6706+ Raises
67076707 -----
6708- For this method to work, the index must to be a :class:`DatetimeIndex`
6708+ AttributeError
6709+ If the index is not a :class:`DatetimeIndex`
67096710
67106711 Parameters
67116712 ----------
@@ -6717,25 +6718,27 @@ def at_time(self, time, asof=False):
67176718
67186719 Examples
67196720 --------
6720- >>> i = pd.date_range('2018-04-09', periods=4, freq='4D2min ')
6721+ >>> i = pd.date_range('2018-04-09', periods=4, freq='12H ')
67216722 >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
67226723 >>> ts
67236724 A
6724- date
67256725 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')
6726+ 2018-04-09 12:00:00 2
6727+ 2018-04-10 00:00:00 3
6728+ 2018-04-10 12:00:00 4
6729+
6730+ >>> ts.at_time('12:00')
67306731 A
6731- date
6732- 2018-04-13 00:02: 00 2
6732+ 2018-04-09 12:00:00 2
6733+ 2018-04-10 12: 00:00 4
67336734
67346735 See Also
67356736 --------
67366737 between_time : Select values between particular times of the day
67376738 first : Select initial periods of time series based on a date offset
67386739 last : Select final periods of time series based on a date offset
6740+ DatetimeIndex.indexer_at_time : Get just the index locations for
6741+ values at particular time of the day
67396742 """
67406743 try :
67416744 indexer = self .index .indexer_at_time (time , asof = asof )
@@ -6748,9 +6751,13 @@ def between_time(self, start_time, end_time, include_start=True,
67486751 """
67496752 Select values between particular times of the day (e.g., 9:00-9:30 AM).
67506753
6751- Notes
6754+ By setting ``start_time`` to be later than ``end_time``,
6755+ you can get the times that are *not* between the two times.
6756+
6757+ Raises
67526758 -----
6753- For this method to work, the index must to be a :class:`DatetimeIndex`
6759+ AttributeError
6760+ If the index is not a :class:`DatetimeIndex`
67546761
67556762 Parameters
67566763 ----------
@@ -6765,24 +6772,35 @@ def between_time(self, start_time, end_time, include_start=True,
67656772
67666773 Examples
67676774 --------
6768- >>> i = pd.date_range('2018-04-09', periods=4, freq='2min ')
6775+ >>> i = pd.date_range('2018-04-09', periods=4, freq='1D20min ')
67696776 >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
67706777 >>> ts
67716778 A
67726779 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')
6780+ 2018-04-10 00:20:00 2
6781+ 2018-04-11 00:40:00 3
6782+ 2018-04-12 01:00:00 4
6783+
6784+ >>> ts.between_time('0:15', '0:45')
67776785 A
6778- 2018-04-09 00:02:00 2
6779- 2018-04-09 00:04:00 3
6786+ 2018-04-10 00:20:00 2
6787+ 2018-04-11 00:40:00 3
6788+
6789+ You get the times that are *not* between two times by setting
6790+ ``start_time`` later than ``end_time``:
6791+
6792+ >>> ts.between_time('0:45', '0:15')
6793+ A
6794+ 2018-04-09 00:00:00 1
6795+ 2018-04-12 01:00:00 4
67806796
67816797 See Also
67826798 --------
67836799 at_time : Select values at a particular time of the day
67846800 first : Select initial periods of time series based on a date offset
67856801 last : Select final periods of time series based on a date offset
6802+ DatetimeIndex.indexer_between_time : Get just the index locations for
6803+ values between particular times of the day
67866804 """
67876805 try :
67886806 indexer = self .index .indexer_between_time (
@@ -7036,29 +7054,36 @@ def first(self, offset):
70367054 Convenience method for subsetting initial periods of time series data
70377055 based on a date offset.
70387056
7039- Notes
7057+ Raises
70407058 -----
7041- For this method to work, the index must to be a :class:`DatetimeIndex`
7059+ NotImplementedError
7060+ If the index is not a :class:`DatetimeIndex`
70427061
70437062 Parameters
70447063 ----------
70457064 offset : string, DateOffset, dateutil.relativedelta
70467065
70477066 Examples
70487067 --------
7049- >>> i = pd.date_range('2018-04-09', periods=4, freq='D ')
7068+ >>> i = pd.date_range('2018-04-09', periods=4, freq='2D ')
70507069 >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
70517070 >>> ts
70527071 A
70537072 2018-04-09 1
7054- 2018-04-10 2
7055- 2018-04-11 3
7056- 2018-04-12 4
7073+ 2018-04-11 2
7074+ 2018-04-13 3
7075+ 2018-04-15 4
7076+
7077+ Get the rows for the first 3 days:
7078+
70577079 >>> ts.first('3D')
70587080 A
70597081 2018-04-09 1
7060- 2018-04-10 2
7061- 2018-04-11 3
7082+ 2018-04-11 2
7083+
7084+ Notice the data for 3 first calender days were returned, not the first
7085+ 3 days observed in the dataset, and therefore data for 2018-04-13 was
7086+ not returned.
70627087
70637088 Returns
70647089 -------
@@ -7094,29 +7119,36 @@ def last(self, offset):
70947119 Convenience method for subsetting final periods of time series data
70957120 based on a date offset.
70967121
7097- Notes
7122+ Raises
70987123 -----
7099- For this method to work, the index must to be a :class:`DatetimeIndex`
7124+ NotImplementedError
7125+ If the index is not a :class:`DatetimeIndex`
71007126
71017127 Parameters
71027128 ----------
71037129 offset : string, DateOffset, dateutil.relativedelta
71047130
71057131 Examples
71067132 --------
7107- >>> i = pd.date_range('2018-04-09', periods=4, freq='D ')
7133+ >>> i = pd.date_range('2018-04-09', periods=4, freq='2D ')
71087134 >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
71097135 >>> ts
71107136 A
71117137 2018-04-09 1
7112- 2018-04-10 2
7113- 2018-04-11 3
7114- 2018-04-12 4
7138+ 2018-04-11 2
7139+ 2018-04-13 3
7140+ 2018-04-15 4
7141+
7142+ Get the rows for the last 3 days:
7143+
71157144 >>> ts.last('3D')
71167145 A
7117- 2018-04-10 2
7118- 2018-04-11 3
7119- 2018-04-12 4
7146+ 2018-04-13 3
7147+ 2018-04-15 4
7148+
7149+ Notice the data for 3 last calender days were returned, not the last
7150+ 3 observed days in the dataset. and therefore data for 2018-04-13 was
7151+ not returned.
71207152
71217153 Returns
71227154 -------
0 commit comments