w3resource

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.

Syntax:

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

Parameters:

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
Required
include_end   bool
Default Value: True
Required
axis   {0 or ‘index’, 1 or ‘columns’}
Default Value: 0
Required

Returns: Series or DataFrame

Raises: TypeError
If the index is not a DatetimeIndex

Example:


Download the above Notebook from here.



Inviting useful, relevant, well-written and unique guest posts