[Numpy-discussion] 'nansqrt' function?

Mauro Cavalcanti maurobio at gmail.com
Wed Feb 13 17:44:26 EST 2019


Chuck,

I attempted to find such a list from the Numpy website. A complete list
like yours should be quite handy for users if available there.

Best regards,

Em qua, 13 de fev de 2019 às 20:10, Charles R Harris <
charlesr.harris at gmail.com> escreveu:

>
>
> On Wed, Feb 13, 2019 at 2:14 PM Mauro Cavalcanti <maurobio at gmail.com>
> wrote:
>
>> Chuck,
>>
>> Sure, using numpy.sqrt works fine.
>>
>> Thank you very much.
>>
>> Best regards,
>>
>> Em qua, 13 de fev de 2019 às 19:09, Charles R Harris <
>> charlesr.harris at gmail.com> escreveu:
>>
>>>
>>>
>>> On Wed, Feb 13, 2019 at 1:35 PM Mauro Cavalcanti <maurobio at gmail.com>
>>> wrote:
>>>
>>>> Dear ALL,
>>>>
>>>> In the process of porting an existing (but abandoned) package to the
>>>> latest version of Numpy, I stumbled upon a call to a 'numpy.nansqrt'
>>>> function, which seems not to exist.
>>>>
>>>> Here is the specific code:
>>>>
>>>> def normTrans(y):
>>>>     denom = np.nansqrt(np.nansum(y**2))
>>>>     return y/denom
>>>>
>>>> As far as I could find, there is no such 'nansqrt' function in the
>>>> current version of Numpy, so I suspect that the above code has not been
>>>> properly tested.
>>>>
>>>> Am I right, or that function had existed in some past version of Numpy?
>>>>
>>>> Thanks in advance for any comments or suggestions.
>>>>
>>>>
>>> I don't recall any such function, but  nansum will not result in any
>>> nans, so plain old sqrt should work.
>>>
>>>
> Note that there are various nan stat functions:
>
> - `nanmin` -- minimum non-NaN value
> - `nanmax` -- maximum non-NaN value
> - `nanargmin` -- index of minimum non-NaN value
> - `nanargmax` -- index of maximum non-NaN value
> - `nansum` -- sum of non-NaN values
> - `nanprod` -- product of non-NaN values
> - `nancumsum` -- cumulative sum of non-NaN values
> - `nancumprod` -- cumulative product of non-NaN values
> - `nanmean` -- mean of non-NaN values
> - `nanvar` -- variance of non-NaN values
> - `nanstd` -- standard deviation of non-NaN values
> - `nanmedian` -- median of non-NaN values
> - `nanquantile` -- qth quantile of non-NaN values
> - `nanpercentile` -- qth percentile of non-NaN values
>
> Chuck
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>


-- 
Dr. Mauro J. Cavalcanti
E-mail: maurobio at gmail.com
Web: http://sites.google.com/site/maurobio
"Life is complex. It consists of real and imaginary parts."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190213/25d5b305/attachment.html>


More information about the NumPy-Discussion mailing list