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
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:
https://github.com/pydata/pandas/blob/c1a0dbc4c0dd79d77b2a34be5bc35493279013ab/pandas/lib.pyx#L342
To quote Wes McKinney Seriously can't
Yeah, well, you know Wes... in for a penny, in for a pound (or something
like that). Significant portions of pandas already needs Cython, so might
as well get as much performance as possible.
Btw, the edge case (if you want to call it that), is if it is given an
N-dimensional array:
import