pandas 1.4.2

ParametersRaisesReturnsBackRef
between_time(self: 'NDFrameT', start_time, end_time, include_start: 'bool_t | lib.NoDefault' = <no_default>, include_end: 'bool_t | lib.NoDefault' = <no_default>, inclusive: 'str | None' = None, axis=None) -> 'NDFrameT'

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

Parameters

start_time : datetime.time or str

Initial time as a time filter limit.

end_time : datetime.time or str

End time as a time filter limit.

include_start : bool, default True

Whether the start time needs to be included in the result.

deprecated

Arguments :None:None:`include_start` and :None:None:`include_end` have been deprecated to standardize boundary inputs. Use :None:None:`inclusive` instead, to set each bound as closed or open.

include_end : bool, default True

Whether the end time needs to be included in the result.

deprecated

Arguments :None:None:`include_start` and :None:None:`include_end` have been deprecated to standardize boundary inputs. Use :None:None:`inclusive` instead, to set each bound as closed or open.

inclusive : {"both", "neither", "left", "right"}, default "both"

Include boundaries; whether to set each bound as closed or open.

axis : {0 or 'index', 1 or 'columns'}, default 0

Determine range time on index or columns value.

Raises

TypeError

If the index is not a DatetimeIndex

Returns

Series or DataFrame

Data from the original object filtered to the specified dates range.

Select values between particular times of the day (e.g., 9:00-9:30 AM).

See Also

DatetimeIndex.indexer_between_time

Get just the index locations for values between particular times of the day.

at_time

Select values at a particular time of the day.

first

Select initial periods of time series based on a date offset.

last

Select final periods of time series based on a date offset.

Examples

This example is valid syntax, but we were not able to check execution
>>> i = pd.date_range('2018-04-09', periods=4, freq='1D20min')
... ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
... ts A 2018-04-09 00:00:00 1 2018-04-10 00:20:00 2 2018-04-11 00:40:00 3 2018-04-12 01:00:00 4
This example is valid syntax, but we were not able to check execution
>>> ts.between_time('0:15', '0:45')
                     A
2018-04-10 00:20:00  2
2018-04-11 00:40:00  3

You get the times that are not between two times by setting start_time later than end_time :

This example is valid syntax, but we were not able to check execution
>>> ts.between_time('0:45', '0:15')
                     A
2018-04-09 00:00:00  1
2018-04-12 01:00:00  4
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.generic.NDFrame.at_time pandas.core.generic.NDFrame.last pandas.core.generic.NDFrame.first

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/generic.py#7761
type: <class 'function'>
Commit: