[Numpy-discussion] view of recarray issue

Ralf Gommers ralf.gommers@googlemail....
Sun Jul 22 13:15:14 CDT 2012


Just a heads up that right now views of recarrays seem to be problematic,
this doesn't work anymore:

>>> import statsmodels.api as sm
>>> dta = sm.datasets.macrodata.load()  # returns a record array with 14 fields
>>> dta.data[['infl', 'realgdp']].view((float,2))

I opened http://projects.scipy.org/numpy/ticket/2187 for this. Probably a
blocker for 1.7.0.

Question: is that really the recommended way to get an (N, 2) size float
array from two columns of a larger record array? If so, why isn't there a
better way? If you'd want to write to that (N, 2) array you have to append
a copy, making it even uglier. Also, then there really should be tests for
views in test_records.py.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120722/86cead17/attachment.html 

More information about the NumPy-Discussion mailing list