pydata / bottleneck

Fast NumPy array functions written in C
BSD 2-Clause "Simplified" License
1.05k stars 101 forks source link

Wrong rolling window calculations #410

Closed Kreol64 closed 2 years ago

Kreol64 commented 2 years ago

Hello,

I found this weird behavior when the number of observations reaches "window": ` import numpy as np import bottleneck as bn import pandas as pd

x = np.arange(20000) std_bottleneck = bn.move_std(x, window=10000, min_count=1, ddof=0) std_numpy = np.zeros(len(x))

for i in range(len(x)): std_numpy[i] = np.std(x[:i+1], ddof=0)

pd.DataFrame({ 'std_bottleneck': std_bottleneck, 'std_numpy': std_numpy }).plot() `

This is present in all moving window functions. I am using 1.3.2 bottleneck version. bottleneck_vs_numpy