:4,1:4] = np.where(mask,b,a[1:4,1:4])
otherwise consider Cython:
http://docs.cython.org/docs/numpy_tutorial.html#tuning-indexing-further
Robert
> 2009/6/18 Cristi Constantin >:
> > I have a question about advanced indexing.
> >
> > I have 2 matrices :
>
e speed.
Thank you again. I will play with your method a little more.
--- On Thu, 6/18/09, Stéfan van der Walt wrote:
From: Stéfan van der Walt
Subject: Re: [Numpy-discussion] Advanced indexing advice?
To: "Discussion of Numerical Python"
Date: Thursday, June 18, 2009, 2:16 AM
Hi
Good day.
I have a question about advanced indexing.
I have 2 matrices :
>>>
a=array([[ 0, 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17],
[18, 19, 20, 21, 22, 23]])
b=array([[1, 0, 1],
[0, 2, 0],
[0, 0, 3]])
>>>
I want t
Thank you Neil Martinsen-Burrell and Scott Sinclair for your answers. :)
It's exactly what i wanted to know. I will use hstack and vstack to "resize" my
array.
Have a nice day.
--- On Wed, 6/17/09, Scott Sinclair wrote:
The resize method of ndarray is currently broken when the 'order'
keyword
Good day.
I have this array:
a = array([[u'0', u'0', u'0', u'0', u'0', u' '],
[u'1', u'1', u'1', u'1', u'1', u' '],
[u'2', u'2', u'2', u'2', u'2', u' '],
[u'3', u'3', u'3', u'3', u'3', u' '],
[u'4', u'4', u'4', u'4', u'4', u'']],
dtype='http://docs.scipy.org/doc/
Good day.
I am trying to unite a Rectangular Unicode Array into one newline-separated
string. Basically each line is separated by next line with '\n', and all
characters from one line are merged.
For example:
import numpy as np
a = np.arange(12).reshape(3,4)
a = np.asarray(a,'U')
# Method
Good day, me again.
I have this string of data :
String = 'i want\nto go\nto the\nbeach'.
I want to rotate this data to left, or to right, after is split it after '\n'.
Note that it's important to use 'U' array, because i might have unicode
characters in this string.
So normal, the text is:
i wa
's the only one that works.
--- On Mon, 5/18/09, Cristi Constantin wrote:
From: Cristi Constantin
Subject: [Numpy-discussion] Overlap arrays with "transparency"
To: "Numpy Discussion"
Date: Monday, May 18, 2009, 5:37 AM
Good day.
I am working on this algorithm for a few
Good day.
I am working on this algorithm for a few weeks now, so i tried almost
everything...
I want to overlap / overwrite 2 matrices, but completely ignore some values (in
this case ignore 0)
Let me explain:
a = [
[1, 2, 3, 4, 5],
[9,7],
[0,0,0,0,0],
[5,5,5] ]
b = [
[0,0,9,9],
[1,1,1,1],
[2,2