Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
craustin opened this issue Dec 13, 2012 · 2 comments
Labels
Milestone

Comments

@craustin
Copy link

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.

@wesm
Copy link
Member

wesm commented Dec 13, 2012

This is related to #2114. I'll have a look

@wesm wesm closed this as completed in 3700b70 Dec 13, 2012
@wesm
Copy link
Member

wesm commented Dec 13, 2012

This general problem really sucks. Need a better overall solution to fp error robustness in moving window functions

yarikoptic added a commit to neurodebian/pandas that referenced this issue Dec 20, 2012
* commit 'v0.10.0b1-51-gbbe2fc1': (518 commits)
  BLD: add patsy, numexpr to ci/print_versions.py
  BUG: fix DataFrame.icol with list of integers when columns are integers with duplicates. close pandas-dev#2259
  TST: unit test to assert behavior described in pandas-dev#2525
  BUG: compat OrderedDict import for python 2.6
  DOC: Emphazise that cython is needed when installing from the repo in install.rst
  BLD: document pytz as a hard dependency
  BUG: import OrderedDict from util.compat for 2.6
  BUG: df.from_dict should respect OrderedDict 2517
  start date -> 7/1/12
  ENH: vbench support for HDFStore      added benchmarchs to compare (100,000) rows:        read/write store        read/write store mixed        read/write table        read/write table wide (200 columns)        read/write table mixed        query wide/table
  TST: refactoring to speed up test suite
  BUG: more floating point error robustness in rolling mean. close pandas-dev#2527
  BUG: fix python 3 zip usage
  DOC: updated HDFStore docs for indexing support and better explanations on how to deal with strings in indexables/values
  ENH: allow index recreation by calling create_table_index with new parameters
  BUG: fixed versioning of the data, not reporting correct warnings
  BUG: fixed string appending when length of subsequent is longer/shorter that existing      removed meta data saving      disable memory tests (and put a try:except: around it)
  DOC: small doc change w.r.t. min_itemsize
  BUG: fixed string truncation in values by passing min_itemsize = { 'values' : 1024 }
  BUG: non-datetime indicies were not being handled correctly in searchings (via Terms)       added support for integer, float, date
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants