mgrid
返回密集的多维”网格“实例
用法:np.mgrid[第1维, 第2维, 第3维...]
维度中的写法为a:b:c
a
,起始索引b
,结束索引c
,步长- 如果为实数,表示间隔。区间为[a, b),左闭右开。
- 如果为复数,表示个数。区间为[a, b],左闭右闭。
返回密集的多维”网格“实例
用法:np.mgrid[第1维, 第2维, 第3维...]
维度中的写法为a:b:c
a
,起始索引b
,结束索引c
,步长约定俗成的以 np为numpy简称的导入方式
import numpy as np
创建一个数组
Return random integers from low (inclusive) to high (exclusive).
从区间 [low, high) 中返回随机的整数数组
1 |
np.random.randint(50) |
1 |
np.random.randint(10, 50) |
1 |
np.random.randint(50, size=10) |
1 |
np.random.randint(10, 50, 10) |