On Fri, Feb 6, 2009 at 09:31, Bruce Southey <bsout...@gmail.com> wrote:
> Hi,
> +1 on the idea but how will this work with other numpy methods?
>
> suppose *arr* is a structured array with dtype:
>
> [('name', 'S25'),
>  ('height', float),
>  ('age', int),
>  ('gender', 'S8')
> ]
>
>
> Would you be able to first define a list of columns such as
> cols=['height', 'age']
> arr[cols]
> This would be a handy feature.

Yes. ndarray.__getitem__() doesn't know anything about where the list
of strings comes from.

> For example, for some compatible array A, would you be able to the
> following with a view
>
> np.linalg.lstsq(A, arr[['age']])
> np.linalg.lstsq(A,arr[['height', 'age']]

No, you'd still get a record array, which lstsq() doesn't know what to do with.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to