Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: count_non_zero behaves differently with axis argument #9873

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

Open
eric-wieser opened this issue Oct 17, 2017 · 1 comment
Open

BUG: count_non_zero behaves differently with axis argument #9873

eric-wieser opened this issue Oct 17, 2017 · 1 comment
Labels

Comments

@eric-wieser
Copy link
Member

eric-wieser commented Oct 17, 2017

In 1.13 and master

>>> arr = np.array([' ', ' ', ' '], np.unicode_)  # or bytes_
>>> arr.nonzero()
(array([], dtype=intp),)
>>> np.count_nonzero(arr)
0
>>> np.count_nonzero(arr, axis=0)
3  # but wait, maybe ' ' is truthy after all!

Apparently in some cases ' ' is considered true, yet in others it is considered false. (cause: #9875)

@eric-wieser
Copy link
Member Author

More details on the inconsistency in #9875.

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

No branches or pull requests

1 participant