RangeFilter

class cocohelper.filters.filter.RangeFilter[source]

Bases: ColumnFilter

Filter rows containing column values in a certain range.

Parameters:
  • rng – A tuple that contains the lower and upper bound.

  • column – The column to filter on.

  • strategy – The RangeStrategy used by the filter.

Method List

_apply(values, column, df)

Applies the filter to the given DataFrame rows.

apply(df)

Apply the filter to the DataFrame

set_strategy(strategy)

Set the filter strategy.

Attributes List

_abc_impl

Methods Details

_apply(values, column, df)[source]

Applies the filter to the given DataFrame rows.

Parameters:
  • values – values to filter in the DataFrame.

  • column (str) – column to filter in the DataFrame.

  • df (DataFrame) – DataFrame to filter.

Returns:

The filtered DataFrame.

Return type:

DataFrame

apply(df)

Apply the filter to the DataFrame

Parameters:

df (DataFrame) – DataFrame to filter

Returns:

The filtered DataFrame.

Return type:

DataFrame

set_strategy(strategy)[source]

Set the filter strategy.

Parameters:

strategy (RangeFilterStrategy) – used for filtering the dataframe when using apply().

Returns:

None.

Attribute Details

_abc_impl = <_abc._abc_data object>