Closed
Description
What is center=True
supposed to do in df.expanding()...
operations?
Using the example from the docstring of .expanding()
:
In [103]: df = DataFrame({'B': [0, 1, 2, np.nan, 4]})
In [105]: df.expanding(2).sum()
Out[105]:
B
0 NaN
1 1.0
2 3.0
3 3.0
4 7.0
Now adding center=True
:
In [106]: df.expanding(2, center=True).sum()
Out[106]:
B
0 3.0
1 3.0
2 7.0
3 7.0
4 6.0
Two observations: it seems it just shifted the first rows (which is not the same as centering) and I don't know where the last values are coming from (and they should certainly not decrease again in an expanding sum with only positive values).
Further, I also cannot think of what it actually should do. If we really want to center it, that would mean returning with a new index (as the real center would only increase with 0.5 and be something like [0, 0.5, 1, 1.5, 2] for those data).
So maybe we should rather remove this keyword for expanding
?