Say if I have
如果我有话
s=np.zeros((5,5))
array([[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.]]) #which is an ndarray
s2=[s[ix,1] for ix in range(2,5)],[s[ix2,1] for ix2 in range(2,5)]
([0.0, 0.0, 0.0], [0.0, 0.0, 0.0]) #which is a tuple
How can I make s2 into an array or ndarray? Thank you in advance.
如何将s2变成数组或ndarray?先感谢您。
1 个解决方案
#1
2
Do the obvious, use np.array()
显而易见,使用np.array()
s2 = np.array(s2)
#1
2
Do the obvious, use np.array()
显而易见,使用np.array()
s2 = np.array(s2)