[Numpy-discussion] stacking record arrays
Mon Jun 21 13:51:56 CDT 2010
On Mon, Jun 21, 2010 at 13:44, Benjamin Root <email@example.com> wrote:
> I ran into a somewhat counter-intuitive situation that probably should be
> documented somewhere with respect to record (structured?) arrays. I wanted
> to stack multiple arrays together that had the same names for the columns.
> Since I was imagining the columns as having the names (as opposed to rows),
> I figured vstack() would do the job, but it merely created a sequence of
> record arrays. Turns out that I had to use hstack() to get what I wanted.
Remember that your structured arrays are simply 1-D vectors of
records. 1-D vectors are primarily treated as row vectors by things
that care about "horizontal" and "vertical" for all dtypes, both
records and "normal" scalars. It just gets a bit confusing because one
often thinks of 1-D arrays of records as being rows and columns.
"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
More information about the NumPy-Discussion