У меня есть матрица формы (25,10), это также может быть любое другое число, кроме 25. Я хочу удалить лишние строки и получить матрицу формы (20,10)
# Let's say your matrix is stored in a variable called "my_matrix" # then you can do something like this: my_matrix = my_matrix[:20] # equals to: my_matrix[0:20] # or: my_matrix = my_matrix[2:22] # or if you are using numpy: indices_to_keep = np.asarray([...indices of elements you want to keep...]) my_matrix = my_matrix[indices_to_keep]