Skip to content

BUG: nanops.nanmedian doesn't work when axis=None #7352

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

Closed
toddrjen opened this issue Jun 5, 2014 · 4 comments · Fixed by #7440
Closed

BUG: nanops.nanmedian doesn't work when axis=None #7352

toddrjen opened this issue Jun 5, 2014 · 4 comments · Fixed by #7440
Labels
Bug Internals Related to non-user accessible pandas implementation Numeric Operations Arithmetic, Comparison, and Logical operations Testing pandas testing functions or related to the test suite
Milestone

Comments

@toddrjen
Copy link
Contributor

toddrjen commented Jun 5, 2014

The default value for the axis argument for nanops.nanmedia is None. However, the function raises an exception when using this value:

>>> from pandas.core import nanops
>>> import bottleneck
>>> import numpy as np
>>> nanops._USE_BOTTLENECK = False
>>> 
>>> val = np.random.randn(13, 11, 7)
>>> 
>>> bottleneck.nanmedian(val, axis=None).ndim
0
>>> nanops.nanmedian(val, axis=None)
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
>>> nanops.nanmedian(val)
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
@jreback
Copy link
Contributor

jreback commented Jun 5, 2014

couple of points

  • their are really NO tests for nanops explicity (a few use it in test_frame/test_common but very limited)
  • need a bottleneck testing decorator to set/unset the _USE_BOTTLENECK switch for testing (e.g. see test_frame/test_sem
  • all of the nan* functions should have assert axis is not None (which we are not testing), as its supposed to ALWAYS be passed in

would welcome tests/fixes for these

@jreback jreback added this to the 0.15.0 milestone Jun 5, 2014
@toddrjen
Copy link
Contributor Author

toddrjen commented Jun 5, 2014

I have fixes for all of these, and an nanops test suite, but I thought you said I needed to raise issues for the problems I found before I submit the pull request.

@jreback
Copy link
Contributor

jreback commented Jun 5, 2014

ahh gr8. yes I wanted issues for these because then you can reference them (conceptually you could put it in the top of the PR as well. but almost always better to create an issue then to close it with a PR. (makes finding it easier at the end of the day)

@jreback
Copy link
Contributor

jreback commented Jun 5, 2014

if this is the only once that doesn't handle axis=None then its a bug, but I still am puzzled how it gets passed that. I think that itself is a problem (that's why I am suggesting putting in asserts)

jreback added a commit that referenced this issue Jun 12, 2014
support axis=None for nanmedian ( issue #7352 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Internals Related to non-user accessible pandas implementation Numeric Operations Arithmetic, Comparison, and Logical operations Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants