- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 19.2k
 
BUG: Aligned skew and kurt results with scipy.stats #62925
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
base: main
Are you sure you want to change the base?
BUG: Aligned skew and kurt results with scipy.stats #62925
Conversation
| result = s.sem(ddof=1) | ||
| assert pd.isna(result) | ||
| 
               | 
          ||
| def test_skew(self): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI Alvaro,
Thank you for the review.
In my previous commit I thought these were duplicated tests, but looking at it again these should not be removed. I will revert and update the tests.
| alt = lambda x: sp_stats.kurtosis(x, bias=False) | ||
| self._check_stat_op("kurt", alt, string_series) | ||
| 
               | 
          ||
| def test_kurt_corner(self): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing this test?
| # fix for handling cases where all elements in an axis are the same | ||
| if isinstance(result, np.ndarray): | ||
| result[np.max(values, axis=axis) == np.min(values, axis=axis)] = 0 | ||
| result[np.max(values, axis=axis) == np.min(values, axis=axis)] = np.nan | ||
| return result | ||
| elif np.max(values) == np.min(values): | ||
| return 0.0 | ||
| return np.nan | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these branches can be removed, since SciPy already assigns NaN.
| # fix for handling cases where all elements in an axis are the same | |
| if isinstance(result, np.ndarray): | |
| result[np.max(values, axis=axis) == np.min(values, axis=axis)] = 0 | |
| result[np.max(values, axis=axis) == np.min(values, axis=axis)] = np.nan | |
| return result | |
| elif np.max(values) == np.min(values): | |
| return 0.0 | |
| return np.nan | 
Co-authored-by: Álvaro Kothe <[email protected]>
Co-authored-by: Álvaro Kothe <[email protected]>
Co-authored-by: Álvaro Kothe <[email protected]>
Co-authored-by: Álvaro Kothe <[email protected]>
Rolling.{skew,kurt}for degenerate distributions #62864 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.