📜  np.arange 和 np.linspace 的区别 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:27.046000             🧑  作者: Mango

代码示例1
# np.arrange allows you to define the stepsize 

>>> np.arange(0,1,0.1) #--> 0.1  is the stepsize or interval 
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])

# np.linspace allows you to define how many values you get including the specified min and max value

>>> np.linspace(0,1,11) #--> 11  no of values you need
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ])