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

scipy.stats.mstats.kurtosistest crashes on 1d input (Trac #1661) #2186

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Closed

scipy.stats.mstats.kurtosistest crashes on 1d input (Trac #1661) #2186

scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected good first issue Good topic for first contributor pull requests, with a relatively straightforward solution Migrated from Trac scipy.stats
Milestone

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/1661 on 2012-05-21 by @dougalsutherland, assigned to unknown.

For example,

>>> stats.mstats.kurtosistest(np.random.normal(size=(100,)))
Traceback (most recent call last):
  File "<ipython-input-11-570df841a764>", line 1, in <module>
    stats.mstats.kurtosistest(np.random.normal(size=(100,)))
  File "/Library/Python/2.7/site-packages/scipy-0.10.1-py2.7-macosx-10.7-x86_64.egg/scipy/stats/mstats_basic.py", line 1628, in kurtosistest
    n = a.count(axis=axis).astype(float)
AttributeError: 'int' object has no attribute 'astype'

This is because ma.count sometimes returns an integer. One possible fix would be to change that line to:

    n = np.asanyarray(a.count(axis=axis), dtype=float)
@scipy-gitbot
Copy link
Author

trac user bdieseldorff wrote on 2012-07-26

After the fix suggested by dougal, the line that reads
denom[denom < 0] = masked
also needs to be changed. In particular, it should be skipped entirely if you have a single float value instead of an array (or maybe give a warning if the only value would get masked?).

@rgommers
Copy link
Member

Fixed by gh-3008.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected good first issue Good topic for first contributor pull requests, with a relatively straightforward solution Migrated from Trac scipy.stats
Projects
None yet
Development

No branches or pull requests

2 participants