关于:
arange([start,] stop [,step,] [,dtype]):返回一个数组,该数组具有按间隔均匀分布的元素。提到的间隔是打开的一半,即[开始,停止]
参数:
start : [optional] start of interval range. By default start = 0 stop : end of interval range step : [optional] step size of interval. By default step size = 1, For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. dtype : type of output array
返回:
Array of evenly spaced values. Length of array being generated = Ceil((Stop - Start) / Step)
# Python Programming illustrating
# numpy.arange method
import numpy as geek
print("A\n", geek.arange(4).reshape(2, 2), "\n")
print("A\n", geek.arange(4, 10), "\n")
print("A\n", geek.arange(4, 20, 3), "\n")
输出:
A [[0 1] [2 3]] A [4 5 6 7 8 9] A [ 4 7 10 13 16 19]
注意:
这些NumPy-Python程序不会在onlineID上运行,因此请在您的系统上运行它们以进行探索。
相关用法
注:本文由纯净天空筛选整理自 numpy.arange() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。