Skip to content

Commit

Permalink
Accessing the correct column for weighted average (#131)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan <[email protected]>
  • Loading branch information
jan-meyer-1986 and jan-meyer-1986 authored Sep 26, 2023
1 parent e3a927e commit ad80020
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion meteostat/utilities/aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def weighted_average(step: pd.DataFrame) -> pd.DataFrame:
"""

data = np.ma.masked_array(step, np.isnan(step))
data = np.ma.average(data, axis=0, weights=data[:, -1])
data = np.ma.average(data, axis=0, weights=data[:, -2])
data = data.filled(np.NaN)

return pd.DataFrame(data=[data], columns=step.columns)
Expand Down

0 comments on commit ad80020

Please sign in to comment.