qis.get_time_period

qis.get_time_period(df=None, index=None, tz=None)[source]

the TimePeriod spanned by a frame’s index, or by an index directly.

TimePeriod is the house type for a date range, so this is the entry point that turns data into one. The timezone is inherited from the index unless tz overrides it, which keeps a localised panel from silently losing its zone downstream.

Parameters:
  • df (Series | DataFrame) – frame or series whose index defines the period. Takes precedence over index

  • index (DatetimeIndex) – index to read instead, when there is no frame to hand

  • tz (str) – timezone for the result. None inherits the index timezone

Returns:

the period from the first to the last index entry, or an empty TimePeriod on an empty index

Raises:

ValueError – if neither df nor index is given

Return type:

TimePeriod