[Numpy-discussion] Multiple-field indexing: view vs copy in 1.14+
Allan Haldane
allanhaldane at gmail.com
Mon Jan 22 11:46:08 EST 2018
On 01/22/2018 11:23 AM, Allan Haldane wrote:
> I just want to note that I
> thought of another way to "fix" this for 1.15 which does not involve
> "pack_fields", which is
>
> a[['b', 'c']].astype('f8,f8').view(('f8', 2))
>
> Which is back-compatible will numpy back to 1.7, I think.
Apologies, this is not back-compatible, do not use it.
I forgot that past versions of numpy had a weird quirk that this will
replace all the structured data with 0s.
Allan
More information about the NumPy-Discussion
mailing list