Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

np.arange and np.linspace difference

# 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. ])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #difference
ADD COMMENT
Topic
Name
9+8 =