flasc.utilities.energy_ratio_utilities.add_ws_bin#
- flasc.utilities.energy_ratio_utilities.add_ws_bin(df_, ws_cols, ws_step=1.0, ws_min=-0.5, ws_max=50.0, edges=None, remove_all_nulls=False)[source]#
Add the ws_bin column to a dataframe.
Given which columns to average over and the step sizes to use
- Return type:
DataFrame
- Parameters:
df (pl.DataFrame) -- The Polars DataFrame containing the column to bin.
ws_cols (list(str)) -- The name of the columns to average across.
ws_step (float) -- Step size for binning
ws_min (float) -- Minimum wind speed
ws_max (float) -- Maximum wind speed
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. Defaults to None, in which case the edges are generated using ws_step, ws_min, and ws_max.
remove_all_nulls (bool) -- (bool): Remove all null values in ws_cols (rather than any)
df_ (DataFrame)
- Returns:
A new Polars DataFrame with an additional ws_bin column
- Return type:
pl.DataFrame