import numpy as np
a = np.array([[10,10],[2,3],[4,5]])
print(a)
[行起始:行结束,列起始:列结束]
s = a[:,1:2]
print(s)
[[10 10]
[ 2 3]
[ 4 5]]
[[10]
[ 3]
[ 5]]
此时对s进行shape 变化的话不会影响a
import numpy as np
a = np.array([[10,10],[2,3],[4,5]])
print(a)
[行起始:行结束,列起始:列结束]
s = a[:,1:2]
print(s)
[[10 10]
[ 2 3]
[ 4 5]]
[[10]
[ 3]
[ 5]]
此时对s进行shape 变化的话不会影响a