Hello,
I have an array that I know will need to grow to X elements. However, I
will need to work with it before it's completely filled. I see two ways
of doing this:
bigarray = np.empty(X)
current_size = 0
for i in something:
buf = produce_data(i)
bigarray[current_size:current_size+len(bu
Gerrit Holl writes:
> On 31 October 2010 17:10, Nikolaus Rath wrote:
>> Hello,
>>
>> I have a couple of numpy arrays which belong together. Unfortunately
>> they have different dimensions, so I can't bundle them into a higher
>> dimensional array.
>>
Hello,
I have a couple of numpy arrays which belong together. Unfortunately
they have different dimensions, so I can't bundle them into a higher
dimensional array.
My solution was to put them into a Python list instead. But
unfortunately this makes it impossible to use any ufuncs.
Has someone el
Warren Weckesser writes:
> Nikolaus Rath wrote:
>> Hello,
>>
>> I want to find the first i such that x[i] < y and x[i+1] >= y. Is there
>> a way to do this without using a Python loop?
>>
>> I can't use np.searchsorted(), because my x array cross
Lane Brooks writes:
> On 08/17/2010 09:53 AM, Nikolaus Rath wrote:
>> Hello,
>>
>> I want to find the first i such that x[i]< y and x[i+1]>= y. Is there
>> a way to do this without using a Python loop?
>>
>> I can't use np.searchsorte
Alan G Isaac writes:
> On 8/17/2010 11:53 AM, Nikolaus Rath wrote:
>> I want to find the first i such that x[i]< y and x[i+1]>= y. Is there
>> a way to do this without using a Python loop?
>
>
> argmax? (to get i+1):
> >>> d = np.lins
Hello,
I want to find the first i such that x[i] < y and x[i+1] >= y. Is there
a way to do this without using a Python loop?
I can't use np.searchsorted(), because my x array crosses y several
times.
Best,
-Nikolaus
--
»Time flies like an arrow, fruit flies like a Banana.«
PGP fingerp
Robert Kern writes:
>> Overloading '*' and '**' while convenient does have consequences. It
>> would be nice if we could have a few more infix operators in Python to
>> allow separation of element-by-element calculations and "dot-product"
>> calculations.
http://www.python.org/dev/peps/pep-022
eat writes:
> Nikolaus Rath rath.org> writes:
>
> [snip]
>> Not quite, because I'm interested in the n largest values over all
>> elements, not the largest element in each row or column. But Keith's
>> solution seems to work fine, even though I'm stil
Keith Goodman writes:
> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote:
>> Keith Goodman writes:
>>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote:
>>>> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote:
>>>>> Hello,
>>
eat writes:
>> How do I best find out the indices of the largest x elements in an
>> array?
>
> Just
> a= np.asarray([[1, 8, 2], [2, 1, 3]])
> print np.where((a.T== a.max(axis= 1)).T)
>
> However, if any row contains more than 1 max entity, above will fail. Please
> let me to know if that's relev
Keith Goodman writes:
> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote:
>> On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote:
>>> Hello,
>>>
>>> How do I best find out the indices of the largest x elements in an
>>> array?
&
Hello,
How do I best find out the indices of the largest x elements in an
array?
Example:
a = [ [1,8,2], [2,1,3] ]
magic_function(a, 2) == [ (0,1), (1,2) ]
Since the largest 2 elements are at positions (0,1) and (1,2).
Best,
-Niko
--
»Time flies like an arrow, fruit flies like a Banana
13 matches
Mail list logo