pandas.DataFrame.between_time

pandas 3.1.1 · DataFrame · method

Select observations within a clock-time range, independent of their calendar dates.

Call syntax

DataFrame.between_time(start_time, end_time, inclusive='both', axis=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
start_time Required
Positional or keyword
datetime.time or str

Set the first clock time considered for a time-of-day selection.

end_time Required
Positional or keyword
datetime.time or str

Set the last clock time considered for a time-of-day selection.

inclusive Optional
Positional or keyword
Default 'both'
{"both", "neither", "left", "right"}

Choose whether the start, end, both, or neither boundary is included.

axis Optional
Positional or keyword
Default None
{0 or 'index', 1 or 'columns'}

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

Returns

Series or DataFrame