pyspark.pandas.DatetimeIndex.indexer_at_time

DatetimeIndex.indexer_at_time(time: Union[datetime.time, str], asof: bool = False) → pyspark.pandas.indexes.base.Index

Return index locations of values at particular time of day (example: 9:30AM).

Parameters
timedatetime.time or str

Time passed in either as object (datetime.time) or as string in appropriate format (“%H:%M”, “%H%M”, “%I:%M%p”, “%I%M%p”, “%H:%M:%S”, “%H%M%S”, “%I:%M:%S%p”, “%I%M%S%p”).

Returns
values_at_timeIndex of integers

Examples

>>> psidx = ps.date_range("2000-01-01", periods=3, freq="T")
>>> psidx  
DatetimeIndex(['2000-01-01 00:00:00', '2000-01-01 00:01:00',
               '2000-01-01 00:02:00'],
              dtype='datetime64[ns]', freq=None)
>>> psidx.indexer_at_time("00:00")
Int64Index([0], dtype='int64')
>>> psidx.indexer_at_time("00:01")
Int64Index([1], dtype='int64')