[Numpy-discussion] another view puzzle

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Jun 3 17:31:32 EDT 2009

On Wed, Jun 3, 2009 at 5:18 PM, Christopher Barker
<Chris.Barker at noaa.gov> wrote:
> josef.pktd at 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 array may be a better bet. the
> only thing matrices buy you is convenient linear algebra operations.

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.

>From the use for data handling in for example matplotlib and the
recarray functions, I thought of structured arrays (and recarrays) as
columns of data. Instead the analogy to database records and (1d)
arrays of structs as in matlab might be better.

The numpy help and documentation is not exactly rich in examples how
to do convert structured arrays to something that can be used for
calculation, except for dictionary access and row iteration. And using
views to access them is not as foolproof as I thought.


> -Chris

More information about the NumPy-Discussion mailing list