'Resize a numpy array to 2048 rows

I am looking for a way to resize NumPy arrays with 3 columns and different rows (e.g. number of rows = 3000, 5234, 2650,...)

What I am trying to do is set the number of rows to 2048 while still having 3 columns. But the deleted rows should be random.

What I did is:

array_2 = array_1[::2, :]

But with that method, I can only divide the number of rows e.g. by to.

I hope I was able to state my question clearly.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source