import numpy
matrix1 = numpy.array([
[5, 10, 15],
[20, 25, 30],
[35, 40, 45]
])
second_column_25 = (matrix[:,1] == 25)
print (second_column_25)
a = matrix[second_column_25, :]
print (a)
print (a.shape)
matrix2 = numpy.array([20, 25, 30])
print (matrix2)
print (matrix2.shape)
import numpy
a = numpy.array([[2,3], [2,3]])
print(a)
print(a.reshape(1, -1))
import numpy
a = numpy.array([[2,3], [2,3]])
print(a)
print(a.flatten()) #也可以用flatten函数将高维数组转化为向量,和reshape不同的是,flatten函数会生成原始数组的复制
import numpy
a = numpy.array([[2,3], [2,3]])
print(a.reshape(-1))
import numpy
matrix1 = numpy.array([
[5, 10, 15],
[20, 25, 30],
[35, 40, 45]
])
print(matrix1)
print(matrix1.reshape(-1))
print(matrix1.reshape(1,-1))
print(matrix1.reshape(9,-1)) #与matlab正好相反