numpy 定义数组:ndmin= 定义数组的最小维度
import numpy
as np
a
= np
.array
([1, 2, 3])
print(a
)
print(type(a
))
b
= np
.array
([1, 2, 3], ndmin
=3)
print(b
)
print(type(b
))
结果
[1 2 3]
<class 'numpy.ndarray'>
[[[1 2 3]]]
<class 'numpy.ndarray'>
Process finished
with exit code
0
转载请注明原文地址:https://tech.qufami.com/read-6989.html