On 04/14/2010 11:34 PM, Nadav Horesh wrote:
> import numpy as N
> N.repeat(N.arange(len(a)), a)
>
>Nadav
>
> -Original Message-
> From: numpy-discussion-boun...@scipy.org on behalf of Peter Shinners
> Sent: Thu 15-Apr-10 08:30
> To: Discussion of Numeric
I am using digitize to create a list of indices. This is giving me
exactly what I want, but it's terribly slow. Digitize is obviously not
the tool I want for this case, but what numpy alternative do I have?
I have an array like np.array((4, 3, 3)). I need to create an index
array with each inde
Is there a way to combine two 1D arrays with the same size into a 2D
array? It seems like the internal pointers and strides could be
combined. My primary goal is to not make any copies of the data. It
might be doable with a bit of ctypes if there is not a native numpy call.
>>> import numpy as
On 04/13/2010 11:44 PM, Gökhan Sever wrote:
On Wed, Apr 14, 2010 at 1:34 AM, Warren Weckesser
<mailto:warren.weckes...@enthought.com>> wrote:
Gökhan Sever wrote:
>
>
> On Wed, Apr 14, 2010 at 1:10 AM, Peter Shinners
mailto:p...@shinners.or
I have an array that represents the number of times a value has been
given. I'm trying to find a direct numpy way to add into these sums
without requiring a Python loop.
For example, say there are 10 possible values. I start with an array of
zeros.
>>> counts = numpy.zeros(10, numpy.int)
Now
On 02/28/2010 10:58 PM, Pierre GM wrote:
> On Mar 1, 2010, at 1:02 AM, Peter Shinners wrote:
>
>>> Here is the code as I would like it to work.
>>>
>> http://python.pastebin.com/CsEnUrSa
>>
>>
>> import numpy as np
>>
>> v
On 02/28/2010 08:01 PM, Pierre GM wrote:
> On Feb 28, 2010, at 8:59 PM, Peter Shinners wrote:
>
>> I have a 2D masked array that has indices into a 1D array. I want to use
>> some form of "take" to fetch the values into the 2D array. I've tried
>> both
I have a 2D masked array that has indices into a 1D array. I want to use
some form of "take" to fetch the values into the 2D array. I've tried
both numpy.take and numpy.ma.take, but they both return a new unmasked
array.
I can get it working by converting the take results into a masked array
a
On 02/24/2010 11:48 PM, Friedrich Romstedt wrote:
> 2010/2/25 Peter Shinners:
>
>> I want a function that works like cumsum, but starts at zero, instead of
>> starting with the first actual value.
>>
>> [...]
>>
>> tallies = np.cumsum(initial_array)
&
On 02/24/2010 09:00 PM, Robert Kern wrote:
> On Wed, Feb 24, 2010 at 22:53, Peter Shinners wrote:
>
>> I want a function that works like cumsum, but starts at zero, instead of
>> starting with the first actual value.
>>
>> For example; I have an array with [4,3,3
I want a function that works like cumsum, but starts at zero, instead of
starting with the first actual value.
For example; I have an array with [4,3,3,1].
Cumsum will give me an array with [4,7,10,11].
I want an array that is like [0,4,7,8].
It looks like I could indirectly do this:
tallies =
11 matches
Mail list logo