rnalysis.filtering.CountFilter.text_filters

CountFilter.text_filters(column: ColumnName, operator: Literal['equals', 'contains', 'starts with', 'ends with'], value: str, opposite: bool = False, inplace: bool = True)

Applay a text filter (equals, contains, starts with, ends with) on a particular column in the Filter object.

Parameters
  • column (str) – name of the column to filter by

  • operator (str: 'eq' / 'equals' / '=', 'ct' / 'contains' / 'in', 'sw' / 'starts with', 'ew' / 'ends with') – the operator to filter the column by (equals, contains, starts with, ends with)

  • value (number (int or float)) – the value to filter by

  • opposite (bool) – If True, the output of the filtering will be the OPPOSITE of the specified (instead of filtering out X, the function will filter out anything BUT X). If False (default), the function will filter as expected.

  • inplace (bool (default=True)) – If True (default), filtering will be applied to the current Filter object. If False, the function will return a new Filter instance and the current instance will not be affected.

Returns

If ‘inplace’ is False, returns a new instance of the Filter object.

Examples
>>> from rnalysis import filtering
>>> filt = filtering.Filter('tests/test_files/text_filters.csv')
>>> # keep only rows that have a value that starts with 'AC3' in the column 'name'.
>>> filt.text_filters('name','sw','AC3')
Filtered 17 features, leaving 5 of the original 22 features. Filtered inplace.