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