-
- Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Labels
API DesignDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Description
For even numbered periods the centered moving average is calculated incorrectly. Suppose the period length is 5. Then the center of 5 periods is 3. However if the period length is 4 then the center of the period is 2.5. The value at index 3 should be the average of the values at 2.5 and 3.5. Pandas is showing the 2.5 value at 3 which is incorrect.
EXAMPLE:
a=pd.Series(range(1,6), index=range(1,6))
a.rolling(4, center=True).mean()
1 NaN
2 NaN
3 2.5
4 3.5
5 NaN
Metadata
Metadata
Assignees
Labels
API DesignDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations