Closed ufechner7 closed 8 years ago
Yes, this package would be a reasonable home for those functions. The nan
prefix isn't needed, I'd prefer NaNMath.argmax
, NaNMath.argmin
, etc. in order to be consistent with the current functions. (I don't want to call nanlog
and nanasin
.)
I guess the current use cases of NaNMath
would just have to be careful about which replacements they make from this package. Ignore-nans vs return-nan-instead-of-throwing are slightly different use cases, so it's mainly the package naming that made this seem worth suggesting.
Are there any cases where ignore-nans and return-nan-instead-of-throwing are in conflict/ambiguous?
Not that I can think of so far.
Thanks for the feedback! If nobody objects, I would start to implement the following functions, ignoring NaN values in the argument:
maximum minimum mean sum std var
Does someone know the equivalent of the numpy functions argmax and argmin in Julia?
I created a pull request to implement the function sum: https://github.com/mlubin/NaNMath.jl/pull/3 Depending on the feedback, I will continue to add the other functions, too.
Does someone know the equivalent of the numpy functions argmax and argmin in Julia?
indmax
and indmin
, I believe
I created another pull request with the rest of the functions: https://github.com/mlubin/NaNMath.jl/pull/5 I did not implement indmax and indmin yet, because currently Base.indmax and Base.indmin ignore NaN values already. This might change in the future.
This is done in release 0.1.0 .
As discussed in https://github.com/JuliaLang/julia/pull/12563#issuecomment-130918285 , it would be useful to have a Julia equivalent of the following numpy functions:
nanargmax nanargmin nanmax nanmin nansum nanmean nanstd nanvar
These functions calculate the maximum etc of an array of values, ignoring any NaN's (instead of promoting them, what Julia will do shortly, probably in the 0.4 release).
Please comment, if this is the right package to add these functions!