On Wed, Jun 3, 2009 at 7:21 PM, Pierre GM wrote:
>
> On Jun 3, 2009, at 7:00 PM, Robert Kern wrote:
>
>> On Wed, Jun 3, 2009 at 17:58, wrote:
>>> Do you have an opinion about whether .view(ndarray_subclass) or
>>> __array_wrap__ is the more appropriate return wrapper for function
>>> such as th
On Jun 3, 2009, at 7:00 PM, Robert Kern wrote:
> On Wed, Jun 3, 2009 at 17:58, wrote:
>> Do you have an opinion about whether .view(ndarray_subclass) or
>> __array_wrap__ is the more appropriate return wrapper for function
>> such as the ones in stats?
>
> __array_wrap__ would be more appropri
On Wed, Jun 3, 2009 at 17:58, wrote:
> Do you have an opinion about whether .view(ndarray_subclass) or
> __array_wrap__ is the more appropriate return wrapper for function
> such as the ones in stats?
__array_wrap__ would be more appropriate. It's what ufuncs use.
--
Robert Kern
"I have come
On Wed, Jun 3, 2009 at 5:55 PM, Robert Kern wrote:
> On Wed, Jun 3, 2009 at 16:31, wrote:
>> On Wed, Jun 3, 2009 at 5:18 PM, Christopher Barker
>> wrote:
>>> josef.p...@gmail.com wrote:
Ok, I didn't know numpy can have structured matrices,
>>>
>>> well, matrices are a subclass of nd-arrays
On Wed, Jun 3, 2009 at 17:53, wrote:
> Is len(z.dtype) > 0 the best way to find out whether an array has a
> structured dtype?
(z.dtype.names is not None) is better.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own
2009/6/3 Robert Kern :
> On Wed, Jun 3, 2009 at 16:31, wrote:
>> I'm very happy with plain numpy arrays, but to handle different data
>> types in scipy.stats, I'm still trying to figure out how views and
>> structured arrays work. And I'm still confused.
>
> .view() is used two different ways, an
On Wed, Jun 3, 2009 at 5:57 PM, Christopher Barker
wrote:
> josef.p...@gmail.com wrote:
>> I'm very happy with plain numpy arrays, but to handle different data
>> types in scipy.stats, I'm still trying to figure out how views and
>> structured arrays work. And I'm still confused.
>
> OK, I'd stay
On Wed, Jun 3, 2009 at 16:31, wrote:
> On Wed, Jun 3, 2009 at 5:18 PM, Christopher Barker
> wrote:
>> josef.p...@gmail.com wrote:
>>> Ok, I didn't know numpy can have structured matrices,
>>
>> well, matrices are a subclass of nd-arrays, so they support it, but it's
>> probably not the least bit
josef.p...@gmail.com wrote:
> I'm very happy with plain numpy arrays, but to handle different data
> types in scipy.stats, I'm still trying to figure out how views and
> structured arrays work. And I'm still confused.
OK, I'd stay away from matrix then, no need to add that confusion
>>From the us
On Wed, Jun 3, 2009 at 5:18 PM, Christopher Barker
wrote:
> josef.p...@gmail.com wrote:
>> Ok, I didn't know numpy can have structured matrices,
>
> well, matrices are a subclass of nd-arrays, so they support it, but it's
> probably not the least bit useful.
>
> See my earlier post to see how to d
josef.p...@gmail.com wrote:
> Ok, I didn't know numpy can have structured matrices,
well, matrices are a subclass of nd-arrays, so they support it, but it's
probably not the least bit useful.
See my earlier post to see how to do what I think you want.
You may not want a matrix anyway -- a 2-d a
On Wed, Jun 3, 2009 at 16:06, wrote:
> On Wed, Jun 3, 2009 at 4:58 PM, Robert Kern wrote:
>> On Wed, Jun 3, 2009 at 15:23, wrote:
>> import numpy as np
>> x = np.array([(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)],
>>> dtype=[('a', '>> ('e', '>>
>> xvm = x.view(np.matr
On Wed, Jun 3, 2009 at 4:58 PM, Robert Kern wrote:
> On Wed, Jun 3, 2009 at 15:23, wrote:
> import numpy as np
> x = np.array([(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)],
>> dtype=[('a', '> ('e', '>
> xvm = x.view(np.matrix)
> xvm
>> matrix([[(0.0, 1.0, 2.0, 3.0, 4
On Wed, Jun 3, 2009 at 15:23, wrote:
import numpy as np
x = np.array([(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)],
> dtype=[('a', ' ('e', '
xvm = x.view(np.matrix)
xvm
> matrix([[(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)]],
> dtype=[('a', ' ('e',
josef.p...@gmail.com wrote:
import numpy as np
x = np.array([(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)],
> dtype=[('a', ' ('e', '
xvm = x.view(np.matrix)
xvm
> matrix([[(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)]],
>dtype=[('a', ' ('e', 'http:/
>>> import numpy as np
>>> x = np.array([(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)],
dtype=[('a', '>> xvm = x.view(np.matrix)
>>> xvm
matrix([[(0.0, 1.0, 2.0, 3.0, 4.0), (1.0, 2.0, 3.0, 4.0, 5.0)]],
dtype=[('a', '>> xvm*2
matrix([[(0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0,
16 matches
Mail list logo