captest.util.get_common_timestep

captest.util.get_common_timestep(data, units='m', string_output=True)

Get the most commonly occuring timestep of data as frequency string.

Parameters:
  • data (Series or DataFrame) – Data with a DateTimeIndex.

  • units (str, default 'm') – String representing date/time unit, such as (D)ay, (M)onth, (Y)ear, (h)ours, (m)inutes, or (s)econds.

  • string_output (bool, default True) – Set to False to return a numeric value.

Returns:

If the string_output is True and the most common timestep is an integer in the specified units then a valid pandas frequency or offset alias is returned. If string_output is false, then a numeric value is returned.

Return type:

str or numeric