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

Make return type Option<usize> #27

Open
jvdd opened this issue Feb 17, 2023 · 0 comments
Open

Make return type Option<usize> #27

jvdd opened this issue Feb 17, 2023 · 0 comments
Labels
unsure Not sure if this is necessary

Comments

@jvdd
Copy link
Owner

jvdd commented Feb 17, 2023

Thought it would be useful to return None when there are NaNs in the array.

But this seems less useful / necessary than I thought as np.argmin returns (just as the current code base) the index of the NaN in the array ⬇️

>>> np.array([1, 2, np.nan, 4], dtype=float).argmin()
2

So the only use-case for returning None would be;

  • when the array is empty (instead of current assertion / panic)
  • when skipping nans and only nans in array

The second use-case seems also less useful / necessary as np.argmin returns (just as the current code base) 0 ⬇️

>>> np.array([np.nan, np.nan], dtype=float).argmin()
0
@jvdd jvdd added the unsure Not sure if this is necessary label Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unsure Not sure if this is necessary
Projects
None yet
Development

No branches or pull requests

1 participant