Skip to content

Commit da067b2

Browse files
committed
remove center from expanding operations
see pandas-dev#20647
1 parent 0ae7e90 commit da067b2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pandas/core/generic.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8775,21 +8775,21 @@ def _add_series_or_dataframe_operations(cls):
87758775
from pandas.core import window as rwindow
87768776

87778777
@Appender(rwindow.rolling.__doc__)
8778-
def rolling(self, window, min_periods=None, center=False,
8778+
def rolling(self, window, min_periods=None,
87798779
win_type=None, on=None, axis=0, closed=None):
87808780
axis = self._get_axis_number(axis)
87818781
return rwindow.rolling(self, window=window,
87828782
min_periods=min_periods,
8783-
center=center, win_type=win_type,
8783+
win_type=win_type,
87848784
on=on, axis=axis, closed=closed)
87858785

87868786
cls.rolling = rolling
87878787

87888788
@Appender(rwindow.expanding.__doc__)
8789-
def expanding(self, min_periods=1, center=False, axis=0):
8789+
def expanding(self, min_periods=1, axis=0):
87908790
axis = self._get_axis_number(axis)
87918791
return rwindow.expanding(self, min_periods=min_periods,
8792-
center=center, axis=axis)
8792+
axis=axis)
87938793

87948794
cls.expanding = expanding
87958795

pandas/core/window.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1333,10 +1333,11 @@ def _get_cov(X, Y):
13331333
# to avoid potential overflow, cast the data to float64
13341334
X = X.astype('float64')
13351335
Y = Y.astype('float64')
1336+
center = self.center or False
13361337
mean = lambda x: x.rolling(window, self.min_periods,
1337-
center=self.center).mean(**kwargs)
1338+
center=center).mean(**kwargs)
13381339
count = (X + Y).rolling(window=window,
1339-
center=self.center).count(**kwargs)
1340+
center=center).count(**kwargs)
13401341
bias_adj = count / (count - ddof)
13411342
return (mean(X * Y) - mean(X) * mean(Y)) * bias_adj
13421343

0 commit comments

Comments
 (0)