Skip to content

rolling_mean returns slightly-negative value on Series with only non-negative values #2527

Closed
@craustin

Description

@craustin

Seeing this in a few cases. This is the simplest repro I can find:

from pandas import date_range, rolling_mean, Series
s = Series(index=date_range('1999-02-03','1999-04-05'))
s['1999-02-03'] = 0.00012456
s['1999-02-04'] = 0.0003
s['1999-04-05'] = 0
rolling_mean(s, 1)['1999-04-05']

Returns 0 in 0.9.0.
Returns -5E-20 in 0.10.0.

We found this issue because we do a sqrt on the result and expected 0s when the input was a 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions