關於:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。