niimpy.preprocessing.filter module

Generic DataFrame filtering

This module provides functions for generic DataFrame filtering. In many cases, it is simpler to do these filtering operations yourself directly on the DataFrames, but these functions simplify the operations of standard arguments in other functions.

niimpy.preprocessing.filter.filter_dataframe(df, user=None, start=None, end=None, rename_columns={})[source]

Standard dataframe preprocessing filter.

This implements some standard and common dataframe preprocessing options, which are used in very many functions. It is likely simpler and more clear to do these yourself on the DataFrames directly.

  • select only certain user: df[‘user’] == user

  • select date range: df[start:end]

  • column map: df.rename(columns=rename_columns)

    It returns a new dataframe (and does not modify the passed one in-place).