Re: [Numpy-discussion] [Suggestion] Labelled Array

2016-02-19 Thread Benjamin Root
matplotlib would be more than happy if numpy could take those functions off
our hands! They don't get nearly the correct visibility in matplotlib
because no one is expecting them to be in a plotting library, and they
don't have any useful unit-tests. None of us made them, so we are very
hesitant to update them because of that.

Cheers!
Ben Root

On Fri, Feb 19, 2016 at 1:39 PM,  wrote:

>
>
> On Fri, Feb 19, 2016 at 12:08 PM, Allan Haldane 
> wrote:
>
>> I also want to add a historical note here, that 'groupby' has been
>> discussed a couple times before.
>>
>> Travis Oliphant even made an NEP for it, and Wes McKinney lightly hinted
>> at adding it to numpy.
>>
>>
>> http://thread.gmane.org/gmane.comp.python.numeric.general/37480/focus=37480
>>
>> http://thread.gmane.org/gmane.comp.python.numeric.general/38272/focus=38299
>> http://docs.scipy.org/doc/numpy-1.10.1/neps/groupby_additions.html
>>
>> Travis's idea for a ufunc method 'reduceby' is more along the lines of
>> what I was originally thinking. Just musing about it, it might cover few
>> small cases pandas groupby might not: It could work on arbitrary ufuncs,
>> and over particular axes of multidimensional data. Eg, to sum over
>> pixels from NxNx3 image data. But maybe pandas can cover the
>> multidimensional case through additional index columns or with Panel.
>>
>
> xarray is now covering that area.
>
> There are also recfunctions in numpy.lib that never got a lot of attention
> and expansion.
> There were plans to cover more of the matplotlib versions in numpy, but I
> have no idea and didn't check what happened to it..
>
> Josef
>
>
>
>>
>> Cheers,
>> Allan
>>
>> On 02/15/2016 05:31 PM, Paul Hobson wrote:
>> > Just for posterity -- any future readers to this thread who need to do
>> > pandas-like on record arrays should look at matplotlib's mlab submodule.
>> >
>> > I've been in situations (::cough:: Esri production ::cough::) where I've
>> > had one hand tied behind my back and unable to install pandas. mlab was
>> > a big help there.
>> >
>> > https://goo.gl/M7Mi8B
>> >
>> > -paul
>> >
>> >
>> >
>> > On Mon, Feb 15, 2016 at 1:28 PM, Lluís Vilanova > > > wrote:
>> >
>> > Benjamin Root writes:
>> >
>> > > Seems like you are talking about xarray:
>> https://github.com/pydata/xarray
>> >
>> > Oh, I wasn't aware of xarray, but there's also this:
>> >
>> >
>> >
>> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#basic-indexing
>> >
>> >
>> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#dimension-oblivious-indexing
>> >
>> >
>> > Cheers,
>> >   Lluis
>> >
>> >
>> >
>> > > Cheers!
>> > > Ben Root
>> >
>> > > On Fri, Feb 12, 2016 at 9:40 AM, Sérgio > > > wrote:
>> >
>> > > Hello,
>> >
>> >
>> > > This is my first e-mail, I will try to make the idea simple.
>> >
>> >
>> > > Similar to masked array it would be interesting to use a label
>> > array to
>> > > guide operations.
>> >
>> >
>> > > Ex.:
>> >  x
>> > > labelled_array(data =
>> >
>> > > [[0 1 2]
>> > > [3 4 5]
>> > > [6 7 8]],
>> > > label =
>> > > [[0 1 2]
>> > > [0 1 2]
>> > > [0 1 2]])
>> >
>> >
>> >  sum(x)
>> > > array([9, 12, 15])
>> >
>> >
>> > > The operations would create a new axis for label indexing.
>> >
>> >
>> > > You could think of it as a collection of masks, one for each
>> > label.
>> >
>> >
>> > > I don't know a way to make something like this efficiently
>> > without a loop.
>> > > Just wondering...
>> >
>> >
>> > > Sérgio.
>> >
>> > > ___
>> > > NumPy-Discussion mailing list
>> > > NumPy-Discussion@scipy.org > >
>> > > https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> >
>> >
>> >
>> >
>> > > ___
>> > > NumPy-Discussion mailing list
>> > > NumPy-Discussion@scipy.org 
>> > > https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> > ___
>> > NumPy-Discussion mailing list
>> > NumPy-Discussion@scipy.org 
>> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> >
>> >
>> >
>> >
>> > ___
>> > NumPy-Discussion mailing list
>> > NumPy-Discussion@scipy.org
>> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> >
>>
>> ___
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org

Re: [Numpy-discussion] [Suggestion] Labelled Array

2016-02-19 Thread josef.pktd
On Fri, Feb 19, 2016 at 12:08 PM, Allan Haldane 
wrote:

> I also want to add a historical note here, that 'groupby' has been
> discussed a couple times before.
>
> Travis Oliphant even made an NEP for it, and Wes McKinney lightly hinted
> at adding it to numpy.
>
> http://thread.gmane.org/gmane.comp.python.numeric.general/37480/focus=37480
> http://thread.gmane.org/gmane.comp.python.numeric.general/38272/focus=38299
> http://docs.scipy.org/doc/numpy-1.10.1/neps/groupby_additions.html
>
> Travis's idea for a ufunc method 'reduceby' is more along the lines of
> what I was originally thinking. Just musing about it, it might cover few
> small cases pandas groupby might not: It could work on arbitrary ufuncs,
> and over particular axes of multidimensional data. Eg, to sum over
> pixels from NxNx3 image data. But maybe pandas can cover the
> multidimensional case through additional index columns or with Panel.
>

xarray is now covering that area.

There are also recfunctions in numpy.lib that never got a lot of attention
and expansion.
There were plans to cover more of the matplotlib versions in numpy, but I
have no idea and didn't check what happened to it..

Josef



>
> Cheers,
> Allan
>
> On 02/15/2016 05:31 PM, Paul Hobson wrote:
> > Just for posterity -- any future readers to this thread who need to do
> > pandas-like on record arrays should look at matplotlib's mlab submodule.
> >
> > I've been in situations (::cough:: Esri production ::cough::) where I've
> > had one hand tied behind my back and unable to install pandas. mlab was
> > a big help there.
> >
> > https://goo.gl/M7Mi8B
> >
> > -paul
> >
> >
> >
> > On Mon, Feb 15, 2016 at 1:28 PM, Lluís Vilanova  > > wrote:
> >
> > Benjamin Root writes:
> >
> > > Seems like you are talking about xarray:
> https://github.com/pydata/xarray
> >
> > Oh, I wasn't aware of xarray, but there's also this:
> >
> >
> >
> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#basic-indexing
> >
> >
> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#dimension-oblivious-indexing
> >
> >
> > Cheers,
> >   Lluis
> >
> >
> >
> > > Cheers!
> > > Ben Root
> >
> > > On Fri, Feb 12, 2016 at 9:40 AM, Sérgio  > > wrote:
> >
> > > Hello,
> >
> >
> > > This is my first e-mail, I will try to make the idea simple.
> >
> >
> > > Similar to masked array it would be interesting to use a label
> > array to
> > > guide operations.
> >
> >
> > > Ex.:
> >  x
> > > labelled_array(data =
> >
> > > [[0 1 2]
> > > [3 4 5]
> > > [6 7 8]],
> > > label =
> > > [[0 1 2]
> > > [0 1 2]
> > > [0 1 2]])
> >
> >
> >  sum(x)
> > > array([9, 12, 15])
> >
> >
> > > The operations would create a new axis for label indexing.
> >
> >
> > > You could think of it as a collection of masks, one for each
> > label.
> >
> >
> > > I don't know a way to make something like this efficiently
> > without a loop.
> > > Just wondering...
> >
> >
> > > Sérgio.
> >
> > > ___
> > > NumPy-Discussion mailing list
> > > NumPy-Discussion@scipy.org 
> > > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> >
> >
> > > ___
> > > NumPy-Discussion mailing list
> > > NumPy-Discussion@scipy.org 
> > > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org 
> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> >
> >
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [Suggestion] Labelled Array

2016-02-19 Thread Allan Haldane
I also want to add a historical note here, that 'groupby' has been
discussed a couple times before.

Travis Oliphant even made an NEP for it, and Wes McKinney lightly hinted
at adding it to numpy.

http://thread.gmane.org/gmane.comp.python.numeric.general/37480/focus=37480
http://thread.gmane.org/gmane.comp.python.numeric.general/38272/focus=38299
http://docs.scipy.org/doc/numpy-1.10.1/neps/groupby_additions.html

Travis's idea for a ufunc method 'reduceby' is more along the lines of
what I was originally thinking. Just musing about it, it might cover few
small cases pandas groupby might not: It could work on arbitrary ufuncs,
and over particular axes of multidimensional data. Eg, to sum over
pixels from NxNx3 image data. But maybe pandas can cover the
multidimensional case through additional index columns or with Panel.

Cheers,
Allan

On 02/15/2016 05:31 PM, Paul Hobson wrote:
> Just for posterity -- any future readers to this thread who need to do
> pandas-like on record arrays should look at matplotlib's mlab submodule. 
> 
> I've been in situations (::cough:: Esri production ::cough::) where I've
> had one hand tied behind my back and unable to install pandas. mlab was
> a big help there.
> 
> https://goo.gl/M7Mi8B
> 
> -paul
> 
> 
> 
> On Mon, Feb 15, 2016 at 1:28 PM, Lluís Vilanova  > wrote:
> 
> Benjamin Root writes:
> 
> > Seems like you are talking about xarray: 
> https://github.com/pydata/xarray
> 
> Oh, I wasn't aware of xarray, but there's also this:
> 
>  
> 
> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#basic-indexing
>  
> 
> https://people.gso.ac.upc.edu/vilanova/doc/sciexp2/user_guide/data.html#dimension-oblivious-indexing
> 
> 
> Cheers,
>   Lluis
> 
> 
> 
> > Cheers!
> > Ben Root
> 
> > On Fri, Feb 12, 2016 at 9:40 AM, Sérgio  > wrote:
> 
> > Hello,
> 
> 
> > This is my first e-mail, I will try to make the idea simple.
> 
> 
> > Similar to masked array it would be interesting to use a label
> array to
> > guide operations.
> 
> 
> > Ex.:
>  x
> > labelled_array(data =
> 
> > [[0 1 2]
> > [3 4 5]
> > [6 7 8]],
> > label =
> > [[0 1 2]
> > [0 1 2]
> > [0 1 2]])
> 
> 
>  sum(x)
> > array([9, 12, 15])
> 
> 
> > The operations would create a new axis for label indexing.
> 
> 
> > You could think of it as a collection of masks, one for each
> label.
> 
> 
> > I don't know a way to make something like this efficiently
> without a loop.
> > Just wondering...
> 
> 
> > Sérgio.
> 
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org 
> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> 
> 
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org 
> > https://mail.scipy.org/mailman/listinfo/numpy-discussion
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org 
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> 
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
> 

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] proposal: new logspace without the log in the argument

2016-02-19 Thread Joseph Fox-Rabinovitz






If the author is willing, I'd say both functions are useful. The "geom" 
prefix is very fitting.
- Joe



-- Original message--From: Robert KernDate: Fri, Feb 19, 2016 08:00To: 
Discussion of Numerical Python;Subject:Re: [Numpy-discussion] proposal: new 
logspace without the log in the argumentOn Fri, Feb 19, 2016 at 12:10 PM, 
Andrew Nelson  wrote:
>
> With respect to geomspace proposals: instead of specifying start and end 
> values and the number of points I'd like to have an option where I can set 
> the start and end points and the ratio. The function would then work out the 
> correct number of points to get closest to the end value.
>
> E.g. geomspace(start=1, finish=2, ratio=1.03)
>
> The first entries would be 1.0, 1.03, 1*1.03**2, etc.
>
> I have a requirement for the correct ratio between the points, and it's a 
> right bind having to calculate the exact number of points needed.

At the risk of extending the twisty little maze of names, all alike, I would 
probably call a function with this signature geomrange() instead. It is more 
akin to arange(start, stop, step) than linspace(start, stop, num_steps).
--
Robert Kern___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] proposal: new logspace without the log in the argument

2016-02-19 Thread Robert Kern
On Fri, Feb 19, 2016 at 12:10 PM, Andrew Nelson  wrote:
>
> With respect to geomspace proposals: instead of specifying start and end
values and the number of points I'd like to have an option where I can set
the start and end points and the ratio. The function would then work out
the correct number of points to get closest to the end value.
>
> E.g. geomspace(start=1, finish=2, ratio=1.03)
>
> The first entries would be 1.0, 1.03, 1*1.03**2, etc.
>
> I have a requirement for the correct ratio between the points, and it's a
right bind having to calculate the exact number of points needed.

At the risk of extending the twisty little maze of names, all alike, I
would probably call a function with this signature geomrange() instead. It
is more akin to arange(start, stop, step) than linspace(start, stop,
num_steps).

--
Robert Kern
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] proposal: new logspace without the log in the argument

2016-02-19 Thread .
What about this API?  You specify the start point, ratio, and number of
points.

http://spacepy.lanl.gov/doc/autosummary/spacepy.toolbox.geomspace.html

On Fri, Feb 19, 2016 at 7:10 AM, Andrew Nelson andyfaff-at-gmail.com |numpy
mailing list/Example Allow|  wrote:

> With respect to geomspace proposals: instead of specifying start and end
> values and the number of points I'd like to have an option where I can set
> the start and end points and the ratio. The function would then work out
> the correct number of points to get closest to the end value..
>
> E.g. geomspace(start=1, finish=2, ratio=1.03)
>
> The first entries would be 1.0, 1.03, 1*1.03**2, etc.
>
> I have a requirement for the correct ratio between the points, and it's a
> right bind having to calculate the exact number of points needed.
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] proposal: new logspace without the log in the argument

2016-02-19 Thread Andrew Nelson
With respect to geomspace proposals: instead of specifying start and end
values and the number of points I'd like to have an option where I can set
the start and end points and the ratio. The function would then work out
the correct number of points to get closest to the end value.

E.g. geomspace(start=1, finish=2, ratio=1.03)

The first entries would be 1.0, 1.03, 1*1.03**2, etc.

I have a requirement for the correct ratio between the points, and it's a
right bind having to calculate the exact number of points needed.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion