<div dir="ltr">It appears that the only reliable way to do this may be to use a loop to modify an object arrays in-place. Pandas has a version of this written in Cython:<div><a href="https://github.com/pydata/pandas/blob/c1a0dbc4c0dd79d77b2a34be5bc35493279013ab/pandas/lib.pyx#L342">https://github.com/pydata/pandas/blob/c1a0dbc4c0dd79d77b2a34be5bc35493279013ab/pandas/lib.pyx#L342</a><br></div><div><br></div><div>To quote Wes McKinney "Seriously can't believe I had to write this function"</div><div><br></div><div>Best,</div><div>Stephan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 9, 2015 at 8:31 AM, Benjamin Root <span dir="ltr"><<a href="mailto:ben.root@ou.edu" target="_blank">ben.root@ou.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>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.<br><br>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.<br><br></div>Am I missing something?<br><br></div>Thanks,<br></div>Ben Root<br></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>