@@ -6761,13 +6761,39 @@ def at_time(self, time, asof=False):
6761
6761
"""
6762
6762
Select values at particular time of day (e.g. 9:30AM).
6763
6763
6764
+ Notes
6765
+ -----
6766
+ For this method to work, the index must to be a :class:`DatetimeIndex`
6767
+
6764
6768
Parameters
6765
6769
----------
6766
6770
time : datetime.time or string
6767
6771
6768
6772
Returns
6769
6773
-------
6770
6774
values_at_time : type of caller
6775
+
6776
+ Examples
6777
+ --------
6778
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='4D2min')
6779
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6780
+ >>> ts
6781
+ A
6782
+ date
6783
+ 2018-04-09 00:00:00 1
6784
+ 2018-04-13 00:02:00 2
6785
+ 2018-04-17 00:04:00 3
6786
+ 2018-04-21 00:06:00 4
6787
+ >>> ts.at_time('0:02')
6788
+ A
6789
+ date
6790
+ 2018-04-13 00:02:00 2
6791
+
6792
+ See Also
6793
+ --------
6794
+ between_time : Select values between particular times of the day
6795
+ first : Select initial periods of time series based on a date offset
6796
+ last : Select final periods of time series based on a date offset
6771
6797
"""
6772
6798
try :
6773
6799
indexer = self .index .indexer_at_time (time , asof = asof )
@@ -6780,6 +6806,10 @@ def between_time(self, start_time, end_time, include_start=True,
6780
6806
"""
6781
6807
Select values between particular times of the day (e.g., 9:00-9:30 AM).
6782
6808
6809
+ Notes
6810
+ -----
6811
+ For this method to work, the index must to be a :class:`DatetimeIndex`
6812
+
6783
6813
Parameters
6784
6814
----------
6785
6815
start_time : datetime.time or string
@@ -6790,6 +6820,27 @@ def between_time(self, start_time, end_time, include_start=True,
6790
6820
Returns
6791
6821
-------
6792
6822
values_between_time : type of caller
6823
+
6824
+ Examples
6825
+ --------
6826
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='2min')
6827
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
6828
+ >>> ts
6829
+ A
6830
+ 2018-04-09 00:00:00 1
6831
+ 2018-04-09 00:02:00 2
6832
+ 2018-04-09 00:04:00 3
6833
+ 2018-04-09 00:06:00 4
6834
+ >>> ts.between_time('0:02', '0:04')
6835
+ A
6836
+ 2018-04-09 00:02:00 2
6837
+ 2018-04-09 00:04:00 3
6838
+
6839
+ See Also
6840
+ --------
6841
+ at_time : Select values at a particular time of the day
6842
+ first : Select initial periods of time series based on a date offset
6843
+ last : Select final periods of time series based on a date offset
6793
6844
"""
6794
6845
try :
6795
6846
indexer = self .index .indexer_between_time (
@@ -7043,17 +7094,39 @@ def first(self, offset):
7043
7094
Convenience method for subsetting initial periods of time series data
7044
7095
based on a date offset.
7045
7096
7097
+ Notes
7098
+ -----
7099
+ For this method to work, the index must to be a :class:`DatetimeIndex`
7100
+
7046
7101
Parameters
7047
7102
----------
7048
7103
offset : string, DateOffset, dateutil.relativedelta
7049
7104
7050
7105
Examples
7051
7106
--------
7052
- ts.first('10D') -> First 10 days
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.first('3D')
7116
+ A
7117
+ 2018-04-09 1
7118
+ 2018-04-10 2
7119
+ 2018-04-11 3
7053
7120
7054
7121
Returns
7055
7122
-------
7056
7123
subset : type of caller
7124
+
7125
+ See Also
7126
+ --------
7127
+ last : Select final 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
7057
7130
"""
7058
7131
from pandas .tseries .frequencies import to_offset
7059
7132
if not isinstance (self .index , DatetimeIndex ):
@@ -7079,17 +7152,39 @@ def last(self, offset):
7079
7152
Convenience method for subsetting final periods of time series data
7080
7153
based on a date offset.
7081
7154
7155
+ Notes
7156
+ -----
7157
+ For this method to work, the index must to be a :class:`DatetimeIndex`
7158
+
7082
7159
Parameters
7083
7160
----------
7084
7161
offset : string, DateOffset, dateutil.relativedelta
7085
7162
7086
7163
Examples
7087
7164
--------
7088
- ts.last('5M') -> Last 5 months
7165
+ >>> i = pd.date_range('2018-04-09', periods=4, freq='D')
7166
+ >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
7167
+ >>> ts
7168
+ A
7169
+ 2018-04-09 1
7170
+ 2018-04-10 2
7171
+ 2018-04-11 3
7172
+ 2018-04-12 4
7173
+ >>> ts.last('3D')
7174
+ A
7175
+ 2018-04-10 2
7176
+ 2018-04-11 3
7177
+ 2018-04-12 4
7089
7178
7090
7179
Returns
7091
7180
-------
7092
7181
subset : type of caller
7182
+
7183
+ See Also
7184
+ --------
7185
+ first : Select initial periods of time series based on a date offset
7186
+ at_time : Select values at a particular time of the day
7187
+ between_time : Select values between particular times of the day
7093
7188
"""
7094
7189
from pandas .tseries .frequencies import to_offset
7095
7190
if not isinstance (self .index , DatetimeIndex ):
0 commit comments