Skip to content

Handle empty inputs in cov and corrcoef. #63

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
wants to merge 2 commits into from

Conversation

rgommers
Copy link
Member

Empty inputs to cov and corrcoef now result in warnings, and return 0 and 1 respectively. This is correct for scalar input but makes no sense for empty input. Raising an exception is also not appreciated usually, so just doing: empty in -> empty out, seems like the most straightforward thing.

Also fixes a minor doc bug and adds a few tests.

Closes #1773.

@rgommers
Copy link
Member Author

See also http://projects.scipy.org/numpy/ticket/440, same issue for mean/median/average. Should be handled the same way probably, no matter what the final desired behavior is.

@rgommers
Copy link
Member Author

And http://projects.scipy.org/numpy/ticket/1387, bincount gives a ValueError

@rgommers
Copy link
Member Author

rgommers commented Apr 1, 2011

Shape is preserved now, see SHA:149e10f58209ce698bbbe1fdf820c55e943bb743

I can merge those to a single commit before pushing.

@rgommers
Copy link
Member Author

rgommers commented Apr 1, 2011

Grr, that Markdown for commits is horrible.
rgommers@149e10f5

@charris
Copy link
Member

charris commented Apr 2, 2011

Looks OK to me.

@rgommers
Copy link
Member Author

rgommers commented Apr 2, 2011

applied

@rgommers rgommers closed this Apr 2, 2011
fangerer added a commit to hpyproject/numpy-hpy that referenced this pull request Jul 7, 2022
…r API

Merge in ~STEPAN.SINDELAR_ORACLE.COM/numpy-hpy from fa/cast_info_xfree to labs-hpy-port

* commit '4222a3e193219deccdc5bc13c000b43d9387e577':
  Migrate function signature NpyIter_IterNextFunc to HPy
  Use HNpyIter_GetInnerFixedStrideArray in execute_ufunc_loop
  Completely remove npyiter_allocate_buffers
  Directly use HNPY_cast_info_xfree
luyahan pushed a commit to plctlab/numpy that referenced this pull request Apr 25, 2024
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.

np.isfinite on structured arrays returns a NotImplemented type object (Trac #1175)
2 participants