numpy arange integers code example
Example 1: np arange
np.arange([start], stop, [step])
>>> np.arange(10) # stop
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.arange(2, 10)
array([2, 3, 4, 5, 6, 7, 8, 9])
>>> np.arange(2, 10, 2)
array([2, 4, 6, 8])
Example 2: numpy arange number of elements
>>> import numpy as np
>>> np.linspace(start=0, stop=7.5, num=4)
array([ 0. , 2.5, 5. , 7.5])
>>> list(_)
[0.0, 2.5, 5.0, 7.5]