Pandas Series: between_time() function

Select values between particular times of the day

The between_time() function is used to select values at particular time of day (e.g. 10:30AM).

By setting start_time to be later than end_time, you can get the times that are not between the two times.


Series.between_time(self, start_time, end_time, include_start=True, include_end=True, axis=None)
Pandas Series between_time image


Name Description Type/Default Value Required / Optional
start_time     datetime.time or str Required
end_time For DataFrame, if not None, only use these columns to check for NaNs. datetime.time or str Required
include_start   bool
Default Value: True
include_end   bool
Default Value: True
axis   {0 or ‘index’, 1 or ‘columns’}
Default Value: 0

Returns: Series or DataFrame

Raises: TypeError
If the index is not a DatetimeIndex


Download the above Notebook from here.

Previous: Select all the values in a row at the particular time of the day
Next: Series.dt.dayofweek() function