numpy arange function

Return Value: () function returns the starting point and end point of a fixed step arrangement np.arange, such as [1,2,3,4,5], 1 is the starting point, end 5 is, in steps of 1. 
The number of parameters are: np.arange () function into a parameter, two parameters, three parameters of the three cases 
1) is a parameter, the parameter value of the end point, starting from the default value of 0, the default value step 1 . 
2) When the two parameters, the first parameter as a starting point, the end point of the second parameter, the step a default value. 
3) When the three parameters, the first parameter as a starting point, the end point of the second parameter, the third parameter is the step size. Which supports fractional step.

example:

#一个参数 默认起点0,步长为1 输出:[0 1 2]
a = np.arange(3)

#两个参数 默认步长为1 输出[3 4 5 6 7 8]
a = np.arange(3,9)

#三个参数 起点为0,终点为4,步长为0.1 输出[ 0.   0.1  0.2  0.3  0.4  0.5  0.6  0.7  0.8  0.9  1.   1.1  1.2  1.3  1.4 1.5  1.6  1.7  1.8  1.9  2.   2.1  2.2  2.3  2.4  2.5  2.6  2.7  2.8  2.9]
a = np.arange(0, 3, 0.1)


------------------------------------------
Original: https: // blog. csdn.net/u011649885/article/details/76851291 

Guess you like

Origin blog.csdn.net/lcczzu/article/details/91413578