candle.data_utils.discretize_dataframe

candle.data_utils.discretize_dataframe#

candle.data_utils.discretize_dataframe(df, col, bins=2, cutoffs=None)#

Discretize values of given column in pandas dataframe.

Parameters:
  • df (pandas dataframe) – dataframe to process.

  • col (int) – Index of column to bin.

  • bins (int) – Number of bins for distributing column values.

  • cutoffs (list) – List of bin limits. If None, the limits are computed as percentiles. (Default: None).

Returns:

  • Returns the data frame with the values of the specified column binned, i.e. the values

  • are replaced by the associated bin number.