Browse Source

Anomaly detector: last NaN value #677

pull/1/head
Alexandr Velikiy 6 years ago committed by Evgeny Smyshlyaev
parent
commit
c1fc44ea10
  1. 4
      analytics/analytics/utils/common.py

4
analytics/analytics/utils/common.py

@ -32,7 +32,9 @@ def exponential_smoothing(series: pd.Series, alpha: float, last_smoothed_value:
result = [0]
for n in range(1, len(series)):
if np.isnan(series[n]):
series[n] = 0
result.append((1 - alpha) * result[n - 1])
series.values[n] = result[n]
else:
result.append(alpha * series[n] + (1 - alpha) * result[n - 1])
return pd.Series(result, index = series.index)

Loading…
Cancel
Save