depth_aggregation

depth_aggregation(df, aggregation_window=0, aggregation_function='median')[source]

Groups input dataframe by columns (depth) and then performs aggregation for each of the created groups. If input dataframe contains multiindex columns, then separates the dataframe over top-level index (0), performs all the same actions on each of the sub-frames, and merges the result into one dataframe with the same structure as the inputted one.

Parameters:
  • df (DataFrame) – The input data with time as rows and depth as columns.

  • aggregation_window (int) – Defines the size of the columns after grouping. For example, for 10 we will receive columns of size 10, e.g. 0, 10, 20, … , 4980, 4990, 5000.

  • aggregation_function (str) – The name of the function that will be used to aggregate data in each of the grouped columns.

Returns:

Dataframe with aggregated columns

Return type:

DataFrame