Skip to content

Conversation

@seth-p
Copy link
Contributor

@seth-p seth-p commented Aug 1, 2014

Closes #7884.

This addresses only the ewm*() functions' off-by-one interpretation of min_periods.
It doesn't address the inconsistency between the ewm*() functions and the rolling_*() functions in the meaning of min_periods.

@jreback
Copy link
Contributor

jreback commented Aug 1, 2014

are there test for min_periods 1 and 0?
if not can u add pls

thxs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removing gratuitous "a" from function names, and adding ewmvol.

@seth-p
Copy link
Contributor Author

seth-p commented Aug 1, 2014

OK, will add tests for min_periods 0 and 1.

@seth-p
Copy link
Contributor Author

seth-p commented Aug 1, 2014

In the process of adding tests for min_periods = 0, 1, I noticed the following, which is really messing up the testing. I think all these functions should return NaN for a single value.

I just noticed that ewmvar, ewmstd, ewmvol, ewmcov, rolling_var, rolling_std, returns 0.0 for a single value (assuming min_periods=0); whereas Series.std, Series.var, ewmcorr, expanding_cov, expanding_corr, expanding_std, expanding_vol, and expanding_var, rolling_cov, and rolling_corr all return NaN for a single value.

@seth-p
Copy link
Contributor Author

seth-p commented Aug 1, 2014

I've updated the code to add tests for min_periods = 0, 1, 2, leaving the single-value behavior noted above unchanged. If want to, can address that in a separate issue/PR: #7900.

@jreback jreback added this to the 0.15.0 milestone Aug 1, 2014
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue at the end

@seth-p
Copy link
Contributor Author

seth-p commented Aug 1, 2014

The Travis CI build passed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to issue and repush and lmk (don't need to wait for green)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh! Am away from computer now; will do later.

On Aug 1, 2014, at 6:40 PM, jreback notifications@github.com wrote:

In doc/source/v0.15.0.txt:

@@ -80,6 +80,11 @@ API changes
ewma(Series([1., None, 100.]), com=2.5, ignore_na=True) # pre-0.15.0 behavior
ewma(Series([1., None, 100.]), com=2.5, ignore_na=False) # default

+- :func:ewma, :func:ewmstd, :func:ewmvol, :func:ewmvar, :func:ewmcorr, and :func:ewmcov

  • now set to NaN the first min_periods-1 entries of the result (for min_periods>1).
  • Previously the first min_periods entries of the result were set to NaN.
  • The new behavior accords with the existing documentation. (:issues:7884)
    change to issue and repush and lmk (don't need to wait for green)


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-pushed an update removing the spurious s.

jreback added a commit that referenced this pull request Aug 2, 2014
BUG: ewm*() interpretation of min_periods is off by one
@jreback jreback merged commit ef5aeae into pandas-dev:master Aug 2, 2014
@jreback
Copy link
Contributor

jreback commented Aug 2, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Design Numeric Operations Arithmetic, Comparison, and Logical operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: ewm*() functions interpret min_periods off by one?

2 participants