flasc.utilities.energy_ratio_utilities.add_ws_bin#
- flasc.utilities.energy_ratio_utilities.add_ws_bin(df_: DataFrame, ws_cols: List[str], ws_step: float = 1.0, ws_min: float = -0.5, ws_max: float = 50.0, edges: ndarray | list | None = None, remove_all_nulls: bool = False) DataFrame [source]#
Add the ws_bin column to a dataframe.
Given which columns to average over and the step sizes to use
- 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