[Numpy-discussion] converting a list of tuples into an array of tuples?

Benjamin Root ben.root at ou.edu
Mon Feb 9 11:31:09 EST 2015


I am trying to write up some code that takes advantage of np.tile() on
arbitrary array-like objects. I only want to tile along the first axis. Any
other axis, if they exist, should be left alone. I first coerce the object
using np.asanyarray(), tile it, and then coerce it back to the original
type.

The problem seems to be that some of my array-like objects are being
"over-coerced", particularly the list of tuples. I tried doing
"np.asanyarray(a, dtype='O')", but that still turns it into a 2-D array.

Am I missing something?

Thanks,
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150209/c9061f34/attachment.html>


More information about the NumPy-Discussion mailing list