1. 程式人生 > >Numpy(ndarray常用函數介紹)

Numpy(ndarray常用函數介紹)

put numpy tro imp color span pre arr nump

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‘>

Numpy(ndarray常用函數介紹)