@@ -6703,13 +6703,39 @@ def at_time(self, time, asof=False):
6703
6703
"""
6704
6704
Select values at particular time of day (e.g. 9:30AM).
6705
6705
6706
+ Notes
6707
+ -----
6708
+ For this method to work, the index must to be a :class:`DateTimeIndex`
6709
+
6706
6710
Parameters
6707
6711
----------
6708
6712
time : datetime.time or string
6709
6713
6710
6714
Returns
6711
6715
-------
6712
6716
values_at_time : type of caller
6717
+
6718
+ Examples
6719
+ --------
6720
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='4D2min')
6721
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6722
+ >>> ts
6723
+ A
6724
+ date
6725
+ 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')
6730
+ A
6731
+ date
6732
+ 2018-04-13 00:02:00 2
6733
+
6734
+ See Also
6735
+ --------
6736
+ between_time : Select values between particular times of the day
6737
+ first : select initial periods of time series based on a date offset
6738
+ last: select final periods of time series based on a date offset
6713
6739
"""
6714
6740
try :
6715
6741
indexer = self .index .indexer_at_time (time , asof = asof )
@@ -6722,6 +6748,10 @@ def between_time(self, start_time, end_time, include_start=True,
6722
6748
"""
6723
6749
Select values between particular times of the day (e.g., 9:00-9:30 AM).
6724
6750
6751
+ Notes
6752
+ -----
6753
+ For this method to work, the index must to be a :class:`DateTimeIndex`
6754
+
6725
6755
Parameters
6726
6756
----------
6727
6757
start_time : datetime.time or string
@@ -6732,6 +6762,27 @@ def between_time(self, start_time, end_time, include_start=True,
6732
6762
Returns
6733
6763
-------
6734
6764
values_between_time : type of caller
6765
+
6766
+ Examples
6767
+ --------
6768
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='2min')
6769
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6770
+ >>> ts
6771
+ A
6772
+ 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
+ A
6778
+ 2018-04-09 00:02:00 2
6779
+ 2018-04-09 00:04:00 3
6780
+
6781
+ See Also
6782
+ --------
6783
+ at_time : Select values at a particular time of the day
6784
+ first : select initial periods of time series based on a date offset
6785
+ last: select final periods of time series based on a date offset
6735
6786
"""
6736
6787
try :
6737
6788
indexer = self .index .indexer_between_time (
@@ -6985,17 +7036,39 @@ def first(self, offset):
6985
7036
Convenience method for subsetting initial periods of time series data
6986
7037
based on a date offset.
6987
7038
7039
+ Notes
7040
+ -----
7041
+ For this method to work, the index must to be a :class:`DateTimeIndex`
7042
+
6988
7043
Parameters
6989
7044
----------
6990
7045
offset : string, DateOffset, dateutil.relativedelta
6991
7046
6992
7047
Examples
6993
7048
--------
6994
- ts.first('10D') -> First 10 days
7049
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='D')
7050
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
7051
+ >>> ts
7052
+ A
7053
+ 2018-04-09 1
7054
+ 2018-04-10 2
7055
+ 2018-04-11 3
7056
+ 2018-04-12 4
7057
+ >>> ts.first('3D')
7058
+ A
7059
+ 2018-04-09 1
7060
+ 2018-04-10 2
7061
+ 2018-04-11 3
6995
7062
6996
7063
Returns
6997
7064
-------
6998
7065
subset : type of caller
7066
+
7067
+ See Also
7068
+ --------
7069
+ last: select final periods of time series based on a date offset
7070
+ at_time : Select values at a particular time of the day
7071
+ between_time : Select values between particular times of the day
6999
7072
"""
7000
7073
from pandas .tseries .frequencies import to_offset
7001
7074
if not isinstance (self .index , DatetimeIndex ):
@@ -7021,17 +7094,39 @@ def last(self, offset):
7021
7094
Convenience method for subsetting final periods of time series data
7022
7095
based on a date offset.
7023
7096
7097
+ Notes
7098
+ -----
7099
+ For this method to work, the index must to be a :class:`DateTimeIndex`
7100
+
7024
7101
Parameters
7025
7102
----------
7026
7103
offset : string, DateOffset, dateutil.relativedelta
7027
7104
7028
7105
Examples
7029
7106
--------
7030
- ts.last('5M') -> Last 5 months
7107
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='D')
7108
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
7109
+ >>> ts
7110
+ A
7111
+ 2018-04-09 1
7112
+ 2018-04-10 2
7113
+ 2018-04-11 3
7114
+ 2018-04-12 4
7115
+ >>> ts.last('3D')
7116
+ A
7117
+ 2018-04-10 2
7118
+ 2018-04-11 3
7119
+ 2018-04-12 4
7031
7120
7032
7121
Returns
7033
7122
-------
7034
7123
subset : type of caller
7124
+
7125
+ See Also
7126
+ --------
7127
+ first : select initial periods of time series based on a date offset
7128
+ at_time : Select values at a particular time of the day
7129
+ between_time : Select values between particular times of the day
7035
7130
"""
7036
7131
from pandas .tseries .frequencies import to_offset
7037
7132
if not isinstance (self .index , DatetimeIndex ):
0 commit comments