I have created a very large NumPy array of size 500 x 10000, called first_array
, to solve a partial differential equation using the Crank Nicolson method. This method needs to create and use all the data stored in the array, but I only need a small part of it. For example, 50 rows and 50 columns would be enough.
How could I create a smaller array, second_array
, from first_array
by selecting only those rows and columns that are multiples of a certain number? Is there any built-in NumPy method for this task?
For example, if first_array
is
array([[11, 12, 13, 14],
[21, 22, 23, 24],
[31, 32, 33, 34],
[14, 42, 43, 44]])
then I would like second_array
to be an array formed with the 1st and 3d rows of first_array
and with the 2ns and 4th column of first_array
:
array([[12, 14],
[32, 34],])