Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread josef . pktd
On Thu, Nov 22, 2012 at 10:15 AM, Sebastian Berg wrote: > On Thu, 2012-11-22 at 16:05 +0100, Daπid wrote: >> On Thu, Nov 22, 2012 at 3:54 PM, wrote: >> > Why don't operations on empty arrays not return empty arrays? >> >> Because functions like mean or std are expected to return a scalar. >> Fun

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Thu, 2012-11-22 at 16:05 +0100, Daπid wrote: > On Thu, Nov 22, 2012 at 3:54 PM, wrote: > > Why don't operations on empty arrays not return empty arrays? > > Because functions like mean or std are expected to return a scalar. > Functions that are piecewiese can (and should) return an empty arr

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Daπid
On Thu, Nov 22, 2012 at 3:54 PM, wrote: > Why don't operations on empty arrays not return empty arrays? Because functions like mean or std are expected to return a scalar. Functions that are piecewiese can (and should) return an empty array, but not the mean.

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread josef . pktd
On Thu, Nov 22, 2012 at 7:14 AM, Sebastian Berg wrote: > On Wed, 2012-11-21 at 22:58 -0500, josef.p...@gmail.com wrote: >> On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris >> wrote: >> > >> > >> > On Wed, Nov 21, 2012 at 7:45 PM, wrote: >> >> >> >> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Dela

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Wed, 2012-11-21 at 22:58 -0500, josef.p...@gmail.com wrote: > On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris > wrote: > > > > > > On Wed, Nov 21, 2012 at 7:45 PM, wrote: > >> > >> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: > >> > Current behavior looks sensible to me. I per

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread josef . pktd
On Wed, Nov 21, 2012 at 10:58 PM, wrote: > On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris > wrote: >> >> >> On Wed, Nov 21, 2012 at 7:45 PM, wrote: >>> >>> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: >>> > Current behavior looks sensible to me. I personally would prefer no >>

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread josef . pktd
On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris wrote: > > > On Wed, Nov 21, 2012 at 7:45 PM, wrote: >> >> On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: >> > Current behavior looks sensible to me. I personally would prefer no >> > warning >> > but I think it makes sense to have on

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Charles R Harris
On Wed, Nov 21, 2012 at 7:45 PM, wrote: > On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: > > Current behavior looks sensible to me. I personally would prefer no > warning > > but I think it makes sense to have one as it can be helpful to detect > issues > > faster. > > I agree that na

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread josef . pktd
On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: > Current behavior looks sensible to me. I personally would prefer no warning > but I think it makes sense to have one as it can be helpful to detect issues > faster. I agree that nan should be the correct answer. (I gave up trying to defi

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Skipper Seabold
On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau wrote: > Current behavior looks sensible to me. I personally would prefer no > warning but I think it makes sense to have one as it can be helpful to > detect issues faster. > > -=- Olivier > It's configurable. [~/] [1]: np.seterr(all='ignore')

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Charles R Harris
Hi Olivier, Please don't top post, it isn't the custom on this list. On Wed, Nov 21, 2012 at 7:22 PM, Olivier Delalleau wrote: > Current behavior looks sensible to me. I personally would prefer no > warning but I think it makes sense to have one as it can be helpful to > detect issues faster. >

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Olivier Delalleau
Current behavior looks sensible to me. I personally would prefer no warning but I think it makes sense to have one as it can be helpful to detect issues faster. -=- Olivier 2012/11/21 Charles R Harris > What should be the value of the mean, var, and std of empty arrays? > Currently > > In [12]:

[Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Charles R Harris
What should be the value of the mean, var, and std of empty arrays? Currently In [12]: a Out[12]: array([], dtype=int64) In [13]: a.mean() Out[13]: nan In [14]: a.std() Out[14]: nan In [15]: a.var() Out[15]: nan I think the nan comes from 0/0. All of these also raise warnings the first time th