
Ah, got it. Thanks, Chris! I thought recarray can be only one-dimensional (like tables with named columns). Maybe it's better to ask directly what I was looking for: something that works like a table with named columns (but no labelling for rows), and keeps data (of different dtypes) in a column-by-column way (and this is numpy, not pandas). Is there such a magic thing? Alex.
22 февр. 2017 г., в 2:10, Chris Barker <chris.barker@noaa.gov> написал(а):
On Tue, Feb 21, 2017 at 3:05 PM, Alex Rogozhnikov <alex.rogozhnikov@yandex.ru <mailto:alex.rogozhnikov@yandex.ru>> wrote: a question about numpy.recarray: There is a parameter order in constructor https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.recarray.h... <https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.recarray.h...>, but it seems to have no effect: x = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[1000], order='C')
you are creating a 1D array here -- there is no difference between Fortran and C order for a 1D array. For 2D:
In [2]: x = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[10,10], order='C')
In [3]: x.strides Out[3]: (160, 16)
In [4]: y = numpy.recarray(dtype=[('a', int), ('b', float)], shape=[10,10], order='F')
In [5]: y.strides Out[5]: (16, 160)
note the easier way to get the strides, too :-)
-CHB
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov <mailto:Chris.Barker@noaa.gov>_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion