1. 由list创建ndarray
1 import numpy as np 2 3 x = [1, 2, 3] 4 print(x) 5 print(type(x)) 6 a = np.array(x) 7 print(a) 8 print(type(a))
output:
[1, 2, 3]
<class ‘list‘>
[1, 2, 3]
<class ‘numpy.ndarray‘>
原文地址:https://www.cnblogs.com/aperolchen/p/9471872.html
时间: 2024-11-05 23:19:43