Util

maintenance

exception pycomlink.util.maintenance.DeprecatedWarning

Bases: UserWarning

pycomlink.util.maintenance.deprecated(instructions)

Flags a method as deprecated. Args:

instructions: A human-friendly string of instructions, such

as: ‘Please migrate to add_proxy() ASAP.’

Note:

Taken from https://gist.github.com/kgriffs/8202106

temporal

pycomlink.util.temporal.aggregate_df_onto_DatetimeIndex(df, new_index, method, label='right', new_index_tz='utc')

Aggregate a DataFrame or Series using a given DatetimeIndex

Parameters:
  • df (pandas.DataFrame) – The dataframe that should be reindexed

  • new_index (pandas.DatetimeIndex) – The time stamp index on which df should be aggregated

  • method (numpy function) – The function to be used for aggregation via DataFrame.groupby(‘new_time_ix’).agg(method)

  • label (str {‘right’, ‘left’}, optional) – Which side of the aggregated period to take the label for the new index from

  • new_index_tz (str, optional) – Defaults to ‘utc’. Note that if new_index already has time zone information, this kwarg is ignored

Returns:

df_reindexed

Return type:

pandas.DataFrame