Skip to content

Commit

Permalink
fix: added a code line in the function bin_aggregation which remove e…
Browse files Browse the repository at this point in the history
…mpty rows in the dataframe in order to correct an issue. Fixes lifewatch#73
  • Loading branch information
SimLrt32 committed Aug 25, 2023
1 parent f7deab9 commit e215a27
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pypam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ def bin_aggregation(ds, data_var, band=None, freq='D'):

df = ds_copy.to_dataframe()
df_resampled = df.resample(freq).agg({data_var: list})
df_resampled = df_resampled[df_resampled['millidecade_bands'].apply(lambda x: len(x) > 0)]
df_agg = pd.DataFrame({'time': df_resampled.index, data_var: df_resampled[data_var]})
df_agg = df_agg.explode(data_var)
df_agg[data_var] = df_agg[data_var].astype(float)
Expand Down

0 comments on commit e215a27

Please sign in to comment.