Skip to content

Commit

Permalink
BUG: fix online ewma with CoW (pandas-dev#55735)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Oct 27, 2023
1 parent c36e302 commit 984d755
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pandas/core/window/ewm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def mean(self, *args, update=None, update_times=None, **kwargs):
result_kwargs["columns"] = self._selected_obj.columns
else:
result_kwargs["name"] = self._selected_obj.name
np_array = self._selected_obj.astype(np.float64).to_numpy()
np_array = self._selected_obj.astype(np.float64, copy=False).to_numpy()
ewma_func = generate_online_numba_ewma_func(
**get_jit_arguments(self.engine_kwargs)
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/window/online.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def online_ewma(
exponentially weighted mean accounting minimum periods.
"""
result = np.empty(values.shape)
weighted_avg = values[0]
weighted_avg = values[0].copy()
nobs = (~np.isnan(weighted_avg)).astype(np.int64)
result[0] = np.where(nobs >= minimum_periods, weighted_avg, np.nan)

Expand Down

0 comments on commit 984d755

Please sign in to comment.