timeseriesx.validation package

Submodules

timeseriesx.validation.frequency module

timeseriesx.validation.frequency.coerce_freq(freq)[source]

return a convenient representation of a frequency as a pandas.DateOffset object

Parameters

freq (str/datetime.timedelta/pandas.Timedelta/pandas.DateOffset) – a frequency string or frequency object to coerce

Returns

coerced frequency object

Return type

pandas.DateOffset

timeseriesx.validation.frequency.infer_freq(series)[source]

infer the frequency from a pandas Series with DatetimeIndex

Parameters

series (pandas.Series) – a pandas Series with DatetimeIndex

Returns

the inferred frequency object

Return type

pandas.DateOffset

timeseriesx.validation.time_zone module

timeseriesx.validation.time_zone.coerce_time_zone(tz)[source]

returns the convenient representation of a time zone as a pytz-based tzinfo-object

Parameters

tz (str/datetime.tzinfo) –

Returns

the coerced time zone object

Return type

datetime.tzinfo

timeseriesx.validation.time_zone.infer_tz_from_series(series)[source]

infer the the time zone from a pandas series with DatetimeIndex

Parameters

series (pandas.Series) – the target series

Returns

the inferred time zone

Return type

datetime.tzinfo

timeseriesx.validation.time_zone.infer_tz_from_timestamp(timestamp)[source]

infer the the time zone from a timestamp object

Parameters

timestamp (pandas.Timestamp/datetime.datetime) – the target timestamp

Returns

the inferred time zone

Return type

datetime.tzinfo

timeseriesx.validation.timestamp_index module

timeseriesx.validation.timestamp_index.index_is_datetime(series, exception=True)[source]

check if the index of a pandas.Series is a valid DatetimeIndex

Parameters
  • series (pandas.Series) – the series holding the index to check

  • exception (bool) – if True, raise an exception in case of invalid DatetimeIndex

Returns

True if index is a valid DatetimeIndex, False otherwise.

Return type

bool

timeseriesx.validation.timestamp_index.index_is_sorted(series, ascending=True, exception=True)[source]

check if the (datetime-) index of a pandas.Series is sorted

Parameters
  • series (pandas.Series) – the series holding the index to check

  • ascending (bool) – if true, check for ascending order, if false for descending order

  • exception (bool) – if True, raise an exception in case of unsorted index

Returns

True if index is sorted, False otherwise.

Return type

bool

timeseriesx.validation.unit module

timeseriesx.validation.unit.coerce_unit(unit)[source]

returns the convenient representation of a unit as a pint.Unit-object

Parameters

unit (str/pint.Unit) – the unit string to parse or a Unit object

Returns

the coerced unit

Return type

pint.Unit

Module contents