Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Charles R Harris
On Wed, Feb 13, 2019 at 3:45 PM Mauro Cavalcanti wrote: > 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. > > In ipython In [1]: numpy.lib.nanfunctions? will give it to you. But it looks like a m

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Mauro Cavalcanti
Thanks! I didn't heard of this package and will look into it. Best regards, Em Qua, 13 de fev de 2019 22:10, Robert McLeod The `bottleneck` library is a very good package if there's some function > in NumPy that you want to handle `nan`s in reductions without exploding. > > https://github.com/kw

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Robert McLeod
The `bottleneck` library is a very good package if there's some function in NumPy that you want to handle `nan`s in reductions without exploding. https://github.com/kwgoodman/bottleneck On Wed, Feb 13, 2019 at 12:35 PM Mauro Cavalcanti wrote: > Dear ALL, > > In the process of porting an existin

Re: [Numpy-discussion] Why slicing Pandas column and then subtract gives NaN?

2019-02-13 Thread Paul Hobson
This is more a question for the pandas list, but since i'm here i'll take a crack. - numpy aligns arrays by position. - pandas aligns by label. So what you did in pandas is roughly equivalent to the following: a = pandas.Series([85, 86, 87, 86], name='a').iloc[1:4].to_frame() b = pandas.S

[Numpy-discussion] Why slicing Pandas column and then subtract gives NaN?

2019-02-13 Thread C W
Dear list, I have the following to Pandas Series: a, b. I want to slice and then subtract. Like this: a[1:4] - b[0:3]. Why does it give me NaN? But it works in Numpy. Example 1: did not work >>>a = pd.Series([85, 86, 87, 86]) >>>b = pd.Series([15, 72, 2, 3]) >>> a[1:4]-b[0:3] 0 NaN 1 14.0 2

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Mauro Cavalcanti
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.har...@gmail.com> escreveu: > > > On Wed, Feb 13, 2019 at 2:14 PM Mauro Cav

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Charles R Harris
On Wed, Feb 13, 2019 at 2:14 PM Mauro Cavalcanti 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.har...@gmail.com> escreveu: > >> >> >> On Wed, Feb 13, 2019 at 1:35 PM Mauro Cav

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Mauro Cavalcanti
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.har...@gmail.com> escreveu: > > > On Wed, Feb 13, 2019 at 1:35 PM Mauro Cavalcanti > wrote: > >> Dear ALL, >> >> In the process of porting an existing (

Re: [Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Charles R Harris
On Wed, Feb 13, 2019 at 1:35 PM Mauro Cavalcanti 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 normTran

[Numpy-discussion] 'nansqrt' function?

2019-02-13 Thread Mauro Cavalcanti
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

Re: [Numpy-discussion] Porting code for Numpy 1.13+ to get rid of "boolean index did not match indexed array along dimension 1" error

2019-02-13 Thread Mauro Cavalcanti
Eric, Implementing either of your suggestions (swapping the lines or using an intermediate variable) worked fine under the latest Numpy (v1.16.1)! Thanks a lot for your help! Best regards, Em ter, 12 de fev de 2019 às 23:06, Eric Wieser escreveu: > It looks like your code is wrong, and numpy