文章目录
list转narray
import numpy as np
l1 = [1,2,3,4,5,6]
array = np.array(l1)
print(type(array))
结果:
<class 'numpy.ndarray'>
narray转list
import numpy as np
arr = np.array([1,2,3,4,5,6])
# 方案一
# l1 = arr.tolist()
# 方案二
# l1 = list(arr)
print(type(l1))
结果:
<class 'list'>
over