np.linspace allows you to define how many values you get including the specified min and max value. It infers the stepsize:

>>> np.linspace(0,1,11)
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ])

np.arange allows you to define the stepsize and infers the number of steps(the number of values you get).

>>> np.arange(0,1,.1)
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])

contributions from user2357112:

np.arange excludes the maximum value unless rounding error makes it do otherwise.

For example, the following results occur due to rounding error:

>>> numpy.arange(1, 1.3, 0.1)
array([1. , 1.1, 1.2, 1.3])

You can exclude the stop value (in our case 1.3) using endpoint=False:

>>> numpy.linspace(1, 1.3, 3, endpoint=False)
array([1. , 1.1, 1.2])
Answer from warped on Stack Overflow
🌐
Statology
statology.org › home › numpy: the difference between np.linspace and np.arange
NumPy: The Difference Between np.linspace and np.arange
July 21, 2022 - linspace allows you to specify the number of steps · arange allows you to specify the size of the steps
🌐
NumPy
numpy.org › doc › stable › user › how-to-partition.html
How to create arrays with regularly-spaced values — NumPy v2.5 Manual
Both numpy.linspace and numpy.arange provide ways to partition an interval (a 1D domain) into equal-length subintervals.
🌐
The Python Coding Stack
thepythoncodingstack.com › notes from the near future › what's the difference between numpy's `arange()` and `linspace()` (a numpy for numpties article)
What's The Difference Between NumPy's `arange()` and `linspace()` (A NumPy for Numpties article)
July 18, 2024 - You use a start, stop and step value when you use arange(). It's up to you to decide the step size. But beware of odd results when using float step sizes or casting into specific data types. If in doubt, use linspace() and work out the number of values you need directly.
🌐
Plain English
python.plainenglish.io › title-numpy-linspace-vs-arange-which-to-choose-for-evenly-spaced-sequences-7ffb36ad98ca
Title: “NumPy: linspace vs arange: Which to Choose for Evenly Spaced Sequences?”
November 24, 2023 - But here’s the twist: `np.linspace` creates values with the start and end points included, while `np.arange` leaves you hanging right before the end point.
🌐
NumPy
numpy.org › doc › 2.3 › user › how-to-partition.html
How to create arrays with regularly-spaced values — NumPy v2.3 Manual
Both numpy.linspace and numpy.arange provide ways to partition an interval (a 1D domain) into equal-length subintervals.
🌐
NumPy
numpy.org › doc › 2.1 › user › how-to-partition.html
How to create arrays with regularly-spaced values — NumPy v2.1 Manual
Both numpy.linspace and numpy.arange provide ways to partition an interval (a 1D domain) into equal-length subintervals.
🌐
NumPy
numpy.org › devdocs › user › how-to-partition.html
How to create arrays with regularly-spaced values — NumPy v2.6.dev0 Manual
Both numpy.linspace and numpy.arange provide ways to partition an interval (a 1D domain) into equal-length subintervals.
Find elsewhere
🌐
NumPy
numpy.org › doc › 2.2 › user › how-to-partition.html
How to create arrays with regularly-spaced values — NumPy v2.2 Manual
Both numpy.linspace and numpy.arange provide ways to partition an interval (a 1D domain) into equal-length subintervals.
🌐
GitHub
github.com › jaysingh35t › 1 › blob › main › NumPy Linspace vs. Arange Choosing the Right Tool for Number Sequences Free Download Available!.md
1/NumPy Linspace vs. Arange Choosing the Right Tool for Number Sequences Free Download Available!.md at main · jaysingh35t/1 · GitHub
Notice that linspace guarantees that the array will contain 10 elements, including both 0 and 1. arange, on the other hand, creates an array where each element is 0.1 greater than the previous, stopping before reaching 1.
🌐
Python Guides
pythonguides.com › python-numpy-linspace
NumPy linspace: Formula, Endpoint, vs arange
May 7, 2025 - They answer two different questions. linspace answers “how many values”, arange answers “how big a step”:
🌐
IncludeHelp
includehelp.com › python › what-is-the-difference-between-np-linspace-and-np-arange-methods.aspx
Python - What is the difference between np.linspace() and np.arange() methods?
February 14, 2023 - The numpy.linspace() allows us to define how many values we get including the specified min and max values. The numpy.arange() allows us to define the stepsize and infers the number of steps(the number of values we get).
🌐
Quora
quora.com › What-is-difference-between-arange-and-linspace-functions-of-NumPy
What is difference between arange() and linspace() functions of NumPy? - Quora
Answer (1 of 6): arange() :- Arange() return values with in a range which has a space between values. Syntax :- numpy.arange(start, stop, step, dtype=None, *, like=None) Example :— linspace() :- Return set of samples with in a given interval. Syntax :- linspace(start, stop, num=50, endpoin...
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: arange() and linspace() to generate evenly spaced values | note.nkmk.me
February 2, 2024 - In NumPy, the np.arange() and np.linspace() functions generate an array (ndarray) of evenly spaced values. You can specify the interval in np.arange() and the number of values in np.linspace(). numpy.arange — NumPy v1.26 Manual · numpy.linspace — NumPy v1.26 Manual ·
🌐
Python Pool
pythonpool.com › home › numpy › numpy arange(): start, stop, step, and examples
The Numpy arange Function and Including Endpoints
July 13, 2026 - Choose arange() for a known step, indexes, and discrete ticks. Choose linspace() for a known sample count, evenly spaced numerical experiments, or a required endpoint.
🌐
CASRAI
casrai.org › guides › research tools & software › statistical software for research › numpy linspace: syntax, parameters and examples
NumPy linspace: Syntax, Parameters, Examples — CASRAI
2 weeks ago - In practice: if the number of points matters (a plotting grid with a known resolution, a fixed number of parameter values), use linspace. If the spacing matters and the values are integers, arange is the direct tool.
🌐
Data Skills Academy
dataskillacademy.com › home › numpy - tutorial › numpy arange vs linspace - tutorial
NumPy arange vs linspace - Tutorial | Numpy – Data Skills Academy
September 10, 2026 - arange creates evenly spaced values with a step, while linspace creates a chosen number of values between two endpoints.
🌐
Arab Psychology
scales.arabpsychology.com › home › what is the difference between np.linspace and np.arange in numpy?
What Is The Difference Between Np.linspace And Np.arange In NumPy?
June 27, 2024 - However, the main difference between the two is that np.linspace generates an array with a specified number of elements, while np.arange generates an array with a specified step size.
🌐
DataCamp
datacamp.com › home › tutorials › python › how to use the numpy linspace() function
How to Use the NumPy linspace() Function | DataCamp
April 5, 2024 - The arange() function generates values within a given interval. Unlike linspace(), the spacing between values is specified rather than the number of values.