flasc.utilities.energy_ratio_utilities.bin_column#
- flasc.utilities.energy_ratio_utilities.bin_column(df_, col_name, bin_col_name, edges)[source]#
Bins the values in the specified column of a Polars DataFrame according to the given edges.
- Return type:
DataFrame
- Parameters:
df (pl.DataFrame) -- The Polars DataFrame containing the column to bin.
col_name (str) -- The name of the column to bin.
bin_col_name (str) -- The name to give the new column containing the bin labels.
edges (array-like) -- The edges of the bins. Values will be placed into the bin whose left edge is the largest edge less than or equal to the value, and whose right edge is the smallest edge greater than the value.
df_ (DataFrame)
- Returns:
A new Polars DataFrame with an additional column containing the bin labels.
- Return type:
pl.DataFrame