crunchers.pandas_helpers package

Submodules

crunchers.pandas_helpers.transformations module

Provide functions for performing non-standard-ish column-wise transformations.

crunchers.pandas_helpers.transformations.apply_ignore_null(func, s, fillwith=None)[source]

Perform func on values on s that are not ‘nan’ or equivalent.

func applied to s after filling the ‘nan’ with fillwith. If fillwith is None, min(s) is used.

You may prefer to use the mean or median like this:

apply_ignore_null(func, s, fillwith=np.mean(s))

Returns a reconstituted pandas.Series with ‘nan’ everywhere there was an original ‘nan’, but with the transformed values everywhere else.

crunchers.pandas_helpers.transformations.apply_pairwise(series, func)[source]

Apply func to items in series pairwise: return dataframe.

crunchers.pandas_helpers.transformations.robust_scale(df)[source]

Return copy of df scaled by (df - df.median()) / MAD(df) where MAD is a function returning the median absolute deviation.

crunchers.pandas_helpers.transformations.std_scale(df)[source]

Return scaled copy of df tolerating columns where stdev == 0.

crunchers.pandas_helpers.transformations.zero_stdv_columns(df)[source]

Return list of column names where standard deviation == 0.

Module contents