flasc.utilities.energy_ratio_utilities.add_wd_bin#
- flasc.utilities.energy_ratio_utilities.add_wd_bin(df_: DataFrame, wd_cols: List[str], wd_step: float = 2.0, wd_min: float = 0.0, wd_max: float = 360.0, edges: ndarray | list | None = None, remove_all_nulls: bool = False)[source]#
Add the wd_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.
wd_cols (list(str)) -- The name of the columns to average across.
wd_step (float) -- Step size for binning
wd_min (float) -- Minimum wind direction
wd_max (float) -- Maximum wind direction
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 wd_cols (rather than any)
df_ (DataFrame)
- Returns:
A new Polars DataFrame with an additional ws_bin column
- Return type:
pl.DataFrame