w3resource

Pandas DataFrame: between_time() function

DataFrame - between_time() function

The between_time() function is used to select values between particular times of the day (e.g., 9:00-9:30 AM).

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

Syntax:

DataFrame.between_time(self, start_time, end_time, include_start=True, include_end=True, axis=None)

Parameters:

Name Description Type/Default Value Required / Optional
start_time              

 

datetime.time or str Required
end_time     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 Pandas DataFrame Notebooks from here.

Previous: DataFrame - at_time() function
Next: DataFrame - drop() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/pandas/dataframe/dataframe-between_time.php