numpy arrays
Manolo MartÃnez
manolo at austrohungaro.com
Wed Mar 23 06:26:48 EDT 2016
On 03/23/16 at 03:06am, Heli wrote:
> I have a 2D numpy array like this:
>
> [[1,2,3,4],
> [1,2,3,4],
> [1,2,3,4]
> [1,2,3,4]]
>
> Is there any fast way to convert this array to
>
> [[1,1,1,1],
> [2,2,2,2]
> [3,3,3,3]
> [4,4,4,4]]
You don't mean just transposing your original array, as in
original_array.T, right?
> In general I would need to retrieve every nth element of the interior
> arrays in to single arrays. I know I can loop over and do this, but I
> have really big arrays and I need the fastest way to do this.
I didn't really get this, so transposing is probably not what you need.
Anyway, just in case!
Manolo
More information about the Python-list
mailing list