基本导入

导入 numpy 模块以使用它的任何部分。

import numpy as np

大多数例子都会使用 np 作为 numpy 的简写。假设代码示例中的 np 表示 numpy。

x = np.array([1,2,3,4])