[Numpy-discussion] flip array on axis

Andreas Hilboll lists at hilboll.de
Wed Jul 10 12:03:38 EDT 2013


On 10.07.2013 17:06, Matthew Brett wrote:
> Hi,
> 
> On Wed, Jul 10, 2013 at 11:02 AM, Andreas Hilboll <lists at hilboll.de> wrote:
>> Hi,
>>
>> there are np.flipud and np.fliplr methods to flip 2d arrays on the first
>> and second dimension, respectively. What can I do to flip an array on an
>> axis which I don't know before runtime? I'd really like to see a
>> np.flip(arr, axis) method which lets me specify which axis to flip on.
> 
> I have something like that that's a few lines long:
> 
> https://github.com/nipy/nibabel/blob/master/nibabel/orientations.py#L231
> 
> Cheers,
> 
> Matthew
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 

Thanks, Matthew! Should this go into numpy itself? If so, I could
prepare a PR, if you point me to the right place (file) to put it.

Cheers, Andreas.



More information about the NumPy-Discussion mailing list