@@ -6770,13 +6770,39 @@ def at_time(self, time, asof=False):
6770
6770
"""
6771
6771
Select values at particular time of day (e.g. 9:30AM).
6772
6772
6773
+ Notes
6774
+ -----
6775
+ For this method to work, the index must to be a :class:`DatetimeIndex`
6776
+
6773
6777
Parameters
6774
6778
----------
6775
6779
time : datetime.time or string
6776
6780
6777
6781
Returns
6778
6782
-------
6779
6783
values_at_time : type of caller
6784
+
6785
+ Examples
6786
+ --------
6787
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='4D2min')
6788
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6789
+ >>> ts
6790
+ A
6791
+ date
6792
+ 2018-04-09 00:00:00 1
6793
+ 2018-04-13 00:02:00 2
6794
+ 2018-04-17 00:04:00 3
6795
+ 2018-04-21 00:06:00 4
6796
+ >>> ts.at_time('0:02')
6797
+ A
6798
+ date
6799
+ 2018-04-13 00:02:00 2
6800
+
6801
+ See Also
6802
+ --------
6803
+ between_time : Select values between particular times of the day
6804
+ first : Select initial periods of time series based on a date offset
6805
+ last : Select final periods of time series based on a date offset
6780
6806
"""
6781
6807
try :
6782
6808
indexer = self .index .indexer_at_time (time , asof = asof )
@@ -6789,6 +6815,10 @@ def between_time(self, start_time, end_time, include_start=True,
6789
6815
"""
6790
6816
Select values between particular times of the day (e.g., 9:00-9:30 AM).
6791
6817
6818
+ Notes
6819
+ -----
6820
+ For this method to work, the index must to be a :class:`DatetimeIndex`
6821
+
6792
6822
Parameters
6793
6823
----------
6794
6824
start_time : datetime.time or string
@@ -6799,6 +6829,27 @@ def between_time(self, start_time, end_time, include_start=True,
6799
6829
Returns
6800
6830
-------
6801
6831
values_between_time : type of caller
6832
+
6833
+ Examples
6834
+ --------
6835
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='2min')
6836
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6837
+ >>> ts
6838
+ A
6839
+ 2018-04-09 00:00:00 1
6840
+ 2018-04-09 00:02:00 2
6841
+ 2018-04-09 00:04:00 3
6842
+ 2018-04-09 00:06:00 4
6843
+ >>> ts.between_time('0:02', '0:04')
6844
+ A
6845
+ 2018-04-09 00:02:00 2
6846
+ 2018-04-09 00:04:00 3
6847
+
6848
+ See Also
6849
+ --------
6850
+ at_time : Select values at a particular time of the day
6851
+ first : Select initial periods of time series based on a date offset
6852
+ last : Select final periods of time series based on a date offset
6802
6853
"""
6803
6854
try :
6804
6855
indexer = self .index .indexer_between_time (
@@ -7052,17 +7103,39 @@ def first(self, offset):
7052
7103
Convenience method for subsetting initial periods of time series data
7053
7104
based on a date offset.
7054
7105
7106
+ Notes
7107
+ -----
7108
+ For this method to work, the index must to be a :class:`DatetimeIndex`
7109
+
7055
7110
Parameters
7056
7111
----------
7057
7112
offset : string, DateOffset, dateutil.relativedelta
7058
7113
7059
7114
Examples
7060
7115
--------
7061
- ts.first('10D') -> First 10 days
7116
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='D')
7117
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
7118
+ >>> ts
7119
+ A
7120
+ 2018-04-09 1
7121
+ 2018-04-10 2
7122
+ 2018-04-11 3
7123
+ 2018-04-12 4
7124
+ >>> ts.first('3D')
7125
+ A
7126
+ 2018-04-09 1
7127
+ 2018-04-10 2
7128
+ 2018-04-11 3
7062
7129
7063
7130
Returns
7064
7131
-------
7065
7132
subset : type of caller
7133
+
7134
+ See Also
7135
+ --------
7136
+ last : Select final periods of time series based on a date offset
7137
+ at_time : Select values at a particular time of the day
7138
+ between_time : Select values between particular times of the day
7066
7139
"""
7067
7140
from pandas .tseries .frequencies import to_offset
7068
7141
if not isinstance (self .index , DatetimeIndex ):
@@ -7088,17 +7161,39 @@ def last(self, offset):
7088
7161
Convenience method for subsetting final periods of time series data
7089
7162
based on a date offset.
7090
7163
7164
+ Notes
7165
+ -----
7166
+ For this method to work, the index must to be a :class:`DatetimeIndex`
7167
+
7091
7168
Parameters
7092
7169
----------
7093
7170
offset : string, DateOffset, dateutil.relativedelta
7094
7171
7095
7172
Examples
7096
7173
--------
7097
- ts.last('5M') -> Last 5 months
7174
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='D')
7175
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
7176
+ >>> ts
7177
+ A
7178
+ 2018-04-09 1
7179
+ 2018-04-10 2
7180
+ 2018-04-11 3
7181
+ 2018-04-12 4
7182
+ >>> ts.last('3D')
7183
+ A
7184
+ 2018-04-10 2
7185
+ 2018-04-11 3
7186
+ 2018-04-12 4
7098
7187
7099
7188
Returns
7100
7189
-------
7101
7190
subset : type of caller
7191
+
7192
+ See Also
7193
+ --------
7194
+ first : Select initial periods of time series based on a date offset
7195
+ at_time : Select values at a particular time of the day
7196
+ between_time : Select values between particular times of the day
7102
7197
"""
7103
7198
from pandas .tseries .frequencies import to_offset
7104
7199
if not isinstance (self .index , DatetimeIndex ):
0 commit comments