watex.utils.cleaner#

watex.utils.cleaner(data, /, columns=None, inplace=False, labels=None, func=None, mode='clean', **kws)[source]#

Sanitize data or columns by dropping specified labels from rows or columns.

If data is not a pandas dataframe, should be converted to dataframe and uses index to drop the labels.

Parameters:
  • data (pd.Dataframe or arraylike2D.) – Dataframe pandas or Numpy two dimensional arrays. If 2D array is passed, it should prior be converted to a daframe by default and drop row index from index parameters

  • columns (single label or list-like) –

    Alternative to specifying axis (

    labels, axis=1 is equivalent to columns=labels).

  • labels (single label or list-like) – Index or column labels to drop. A tuple will be used as a single label and not treated as a list-like.

  • func (F, callable) – Universal function used to clean the columns. If performs only when mode is on clean option.

  • inplace (bool, default False) – If False, return a copy. Otherwise, do operation inplace and return None.

  • mode (str, default='clean') – Options or mode of operation to do on the data. It could be [‘clean’|’drop’]. If drop, it behaves like dataframe.drop of pandas.

Returns:

DataFrame cleaned or without the removed index or column labels or None if inplace=True or array is data is passed as an array.

Return type:

DataFrame, array2D or None