Skip to content

Update rolling skew & kurtosis to handle cases where they aren't defined #5760

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

Merged
merged 1 commit into from
Jan 16, 2014
Merged

Update rolling skew & kurtosis to handle cases where they aren't defined #5760

merged 1 commit into from
Jan 16, 2014

Conversation

yieldsfalsehood
Copy link
Contributor

closes #5749

The rolling skewness and kurtosis in algos.pyx were modified to match
the testing logic in pandas/core/nanops.py. They now both return NaN
where they are not defined, which occurs where there are either too
few observations or where the variance is zero.

A set of tests was added to verify that Nan is returned in these cases
and that the computations continue to work correctly when the values
are defined.

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

can you put this instead in pandas/stats/tests/tests_moments.py

@jreback
Copy link
Contributor

jreback commented Jan 15, 2014

pls add a mention in Bug Fixes in 0.13.1...thxs

otherwise looks ready to go

@yieldsfalsehood
Copy link
Contributor Author

I made those changes. I noticed there were already tests for the rolling moments but they were geared towards randomized series of acceptable length, so I added these tests separately - I gave them the umbrella title "edge cases". Is that sufficient?

@jreback
Copy link
Contributor

jreback commented Jan 15, 2014

@yieldsfalsehood perfect thanks

just need to rebase away the track branch...so this:

git fetch upstream
git rebase -i upstream/master

delete the merge remote-tracking branch

then

git push upstream thisbranchname -f

see here: https://github.com/pydata/pandas/wiki/Using-Git

@yieldsfalsehood
Copy link
Contributor Author

Woops! Sorry.

@jreback
Copy link
Contributor

jreback commented Jan 15, 2014

pls rebase and then I think can mergge this

The rolling skewness and kurtosis in algos.pyx were modified to match
the testing logic in pandas/core/nanops.py. They now both return NaN
where they are not defined, which occurs where there are either too
few observations or where the variance is zero.

A set of tests was added to verify that Nan is returned in these cases
and that the computations continue to work correctly when the values
are defined.
@yieldsfalsehood
Copy link
Contributor Author

There we go. Sorry - first PR. Thanks for the patience.

jreback added a commit that referenced this pull request Jan 16, 2014
Update rolling skew & kurtosis to handle cases where they aren't defined
@jreback jreback merged commit 6641c83 into pandas-dev:master Jan 16, 2014
@jreback
Copy link
Contributor

jreback commented Jan 16, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rolling skewness and kurtosis fail on a sample of all equal values
2 participants