{"id":23500,"date":"2022-07-20T12:17:33","date_gmt":"2022-07-20T06:47:33","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=23500"},"modified":"2026-07-13T12:40:30","modified_gmt":"2026-07-13T07:10:30","slug":"numpy-arange","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/numpy-arange\/","title":{"rendered":"NumPy arange(): Start, Stop, Step, and Examples"},"content":{"rendered":"<p><code>numpy.arange()<\/code> creates a NumPy array from a start value, a stop boundary, and a step. It resembles Python&#8217;s built-in <code>range()<\/code>, but returns an array and supports numeric dtypes. The most important rule is that <code>stop<\/code> is excluded. Use <code>arange()<\/code> when the step size is the requirement; use <code>linspace()<\/code> when the number of samples or an included endpoint is the requirement.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Quick_answer\" >Quick answer<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Create_a_basic_range\" >Create a basic range<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Use_start_stop_and_step\" >Use start, stop, and step<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Remember_that_stop_is_excluded\" >Remember that stop is excluded<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Choose_dtype_deliberately\" >Choose dtype deliberately<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Use_a_negative_step\" >Use a negative step<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Reshape_generated_values\" >Reshape generated values<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Decide_between_arange_and_linspace\" >Decide between arange and linspace<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Test_the_boundary_cases\" >Test the boundary cases<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Be_cautious_with_floating_steps\" >Be cautious with floating steps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Keep_memory_in_mind\" >Keep memory in mind<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Document_the_endpoint_contract\" >Document the endpoint contract<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#What_does_NumPy_arange_do\" >What does NumPy arange() do?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Is_the_stop_value_included_in_nparange\" >Is the stop value included in np.arange()?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#When_should_I_use_linspace_instead_of_arange\" >When should I use linspace instead of arange?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Why_can_nparange_show_floating-point_noise\" >Why can np.arange() show floating-point noise?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Quick_answer\"><\/span>Quick answer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Call <code>np.arange(stop)<\/code> for values beginning at zero, or <code>np.arange(start, stop, step)<\/code> for a custom sequence. The result follows repeated steps while staying on the valid side of the stop boundary. The official <a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/generated\/numpy.arange.html\">NumPy arange documentation<\/a> covers the parameters, dtype behavior, and endpoint notes.<\/p>\n<figure class=\"pythonpool-article-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-range-grid.png\" alt=\"NumPy arange diagram showing start stop step, excluded endpoint, linspace comparison, dtype, and negative step\" width=\"1536\" height=\"1024\" loading=\"lazy\" decoding=\"async\"><figcaption>arange follows repeated steps and excludes the stop boundary; use linspace when sample count or endpoint inclusion matters.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Create_a_basic_range\"><\/span>Create a basic range<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With one argument, <code>arange()<\/code> starts at zero and advances by one until the next value would reach the stop value.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\nnumbers = np.arange(5)\nprint(numbers)\n<\/code><\/pre>\n<p>The output contains <code>0<\/code> through <code>4<\/code>. The value <code>5<\/code> is the boundary, not an item in the result. This form is useful for array positions, small test inputs, and labels that correspond to zero-based indexes.<\/p>\n<p><!-- Python Pool visual layout repair 2026-07-13 --><\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/arange-bounds-b159.png\" alt=\"Python Pool infographic showing NumPy arange start, stop, half-open interval, and generated values\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Start and stop: NumPy arange start, stop, half-open interval, and generated values.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Use_start_stop_and_step\"><\/span>Use start, stop, and step<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Pass all three arguments when the first value or spacing is meaningful. A positive step produces an increasing sequence, and a negative step produces a decreasing sequence.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\neven_numbers = np.arange(2, 10, 2)\nodd_numbers = np.arange(9, 0, -2)\n\nprint(even_numbers)\nprint(odd_numbers)\n<\/code><\/pre>\n<p>For an increasing range, the start should be below the stop and the step should be positive. For a decreasing range, the start should be above the stop and the step should be negative. A direction mismatch produces an empty array rather than reversing the sequence automatically.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Remember_that_stop_is_excluded\"><\/span>Remember that stop is excluded<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If the step does not land exactly on the stop value, NumPy still omits the next value once the boundary would be crossed. Do not assume that the last element is always <code>stop - step<\/code>; it depends on whether the repeated steps fit the interval.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\nvalues = np.arange(1, 10, 3)\nprint(values)\n<\/code><\/pre>\n<p>If the consumer needs a guaranteed endpoint, calculate the sequence with <code>np.linspace()<\/code> and specify the sample count. Its endpoint behavior is different and is documented in the <a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/generated\/numpy.linspace.html\">NumPy linspace reference<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Choose_dtype_deliberately\"><\/span>Choose dtype deliberately<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>NumPy infers a dtype from the inputs, but you can pass <code>dtype<\/code> when the output type is part of the contract. Integer arrays are useful for positions and indexes. Floating arrays are appropriate for measurements, but floating-step values can show small representation differences.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\nindexes = np.arange(4, dtype=np.int64)\nfractions = np.arange(0, 1, 0.2, dtype=np.float64)\n\nprint(indexes.dtype)\nprint(fractions)\n<\/code><\/pre>\n<p>For decimal values where exact spacing or exact endpoints matter, use <code>linspace()<\/code> or generate integer ticks and scale them afterward. Compare floating arrays with tolerances instead of exact equality.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/arange-step-b159.png\" alt=\"Python Pool infographic mapping arange through positive step, negative step, length, and sequence\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Step size: Arange through positive step, negative step, length, and sequence.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Use_a_negative_step\"><\/span>Use a negative step<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A negative step is a concise way to count down. The stop boundary remains excluded, but the comparison direction changes.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\ncountdown = np.arange(5, -1, -1)\nprint(countdown)\n<\/code><\/pre>\n<p>If the direction and step disagree, such as <code>np.arange(0, 5, -1)<\/code>, the result is empty. Validate the sign when the step comes from user input or configuration.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Reshape_generated_values\"><\/span>Reshape generated values<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>arange()<\/code> returns a one-dimensional array. Use <code>reshape()<\/code> when the number of generated values matches the target shape. Reshaping changes the view of the values, not the sequence itself.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\ngrid = np.arange(12).reshape(3, 4)\nprint(grid)\n<\/code><\/pre>\n<p>Keep the element count consistent: a twelve-element array can become <code>(3, 4)<\/code> or <code>(2, 6)<\/code>, but not <code>(3, 5)<\/code>. For large ranges, consider memory usage because the complete array is materialized immediately.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/arange-dtype-b159.png\" alt=\"Python Pool infographic comparing integer, float, dtype, endpoint, and rounding behavior\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Dtype choice: Integer, float, dtype, endpoint, and rounding behavior.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Decide_between_arange_and_linspace\"><\/span>Decide between arange and linspace<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Choose <code>arange()<\/code> for a known step, indexes, and discrete ticks. Choose <code>linspace()<\/code> for a known sample count, evenly spaced numerical experiments, or a required endpoint. This choice is more important than the superficial similarity between their outputs.<\/p>\n<p>For related array operations, see <a href=\"https:\/\/www.pythonpool.com\/numpy-sin\/\">NumPy sin()<\/a>, <a href=\"https:\/\/www.pythonpool.com\/numpy-reshape\/\">NumPy reshape()<\/a>, and <a href=\"https:\/\/www.pythonpool.com\/numpy-asarray\/\">NumPy asarray()<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Test_the_boundary_cases\"><\/span>Test the boundary cases<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When <code>start<\/code>, <code>stop<\/code>, or <code>step<\/code> comes from configuration, test the values that change the sequence shape. A zero step is invalid and raises an error. Equal start and stop values produce an empty array. A direction mismatch also produces an empty result. These cases are useful validation points for a helper that wraps <code>arange()<\/code>.<\/p>\n<pre><code class=\"language-python\">import numpy as np\n\nfor start, stop, step in [(0, 0, 1), (0, 5, -1), (5, 0, -1)]:\n    values = np.arange(start, stop, step)\n    print(start, stop, step, values)\n<\/code><\/pre>\n<p>Do not treat an empty array as an exception automatically. It can be the correct representation of an interval with no values, but it can also indicate that a caller supplied the wrong step sign. The surrounding API should make that distinction explicit.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Be_cautious_with_floating_steps\"><\/span>Be cautious with floating steps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Binary floating-point cannot represent every decimal fraction exactly. A decimal step may therefore contain values that print slightly differently from the values written in a specification, and the endpoint can be affected by accumulated representation error. Use integer ticks and scale them for predictable decimal grids, or use <code>linspace()<\/code> when a fixed sample count is the requirement.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/arange-check-b159.png\" alt=\"Python Pool infographic testing zero step, empty output, floating drift, and descending ranges\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Range checks: Zero step, empty output, floating drift, and descending ranges.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Keep_memory_in_mind\"><\/span>Keep memory in mind<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>arange()<\/code> materializes every value immediately. That is convenient for vectorized NumPy operations, but a very large range can consume significant memory. If the consumer only needs one value at a time, consider Python&#8217;s lazy <code>range()<\/code> or a generator. If the consumer needs array operations, choose a dtype that does not use more precision than the calculation requires.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Document_the_endpoint_contract\"><\/span>Document the endpoint contract<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Functions that accept an arange-style interval should say whether the stop is exclusive and whether a floating endpoint is approximate. Naming a parameter <code>stop_exclusive<\/code> or documenting the half-open interval can prevent callers from adding an unexplained step to force a desired final value.<\/p>\n<p>That contract also makes index calculations easier to review.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"What_does_NumPy_arange_do\"><\/span>What does NumPy arange() do?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>np.arange() returns an array of evenly spaced values from start up to, but not including, the stop boundary.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Is_the_stop_value_included_in_nparange\"><\/span>Is the stop value included in np.arange()?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>No. The stop value is excluded, so the final item depends on whether repeated steps fit before the boundary.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"When_should_I_use_linspace_instead_of_arange\"><\/span>When should I use linspace instead of arange?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use linspace when the number of samples or an included endpoint matters more than specifying a step size.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Why_can_nparange_show_floating-point_noise\"><\/span>Why can np.arange() show floating-point noise?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Decimal steps cannot always be represented exactly in binary floating point, so use linspace or tolerances when exact spacing matters.<\/p>\n<p><script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What does NumPy arange() do?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"np.arange() returns an array of evenly spaced values from start up to, but not including, the stop boundary.\"}},{\"@type\":\"Question\",\"name\":\"Is the stop value included in np.arange()?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"No. The stop value is excluded, so the final item depends on whether repeated steps fit before the boundary.\"}},{\"@type\":\"Question\",\"name\":\"When should I use linspace instead of arange?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Use linspace when the number of samples or an included endpoint matters more than specifying a step size.\"}},{\"@type\":\"Question\",\"name\":\"Why can np.arange() show floating-point noise?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Decimal steps cannot always be represented exactly in binary floating point, so use linspace or tolerances when exact spacing matters.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Build NumPy ranges with start, stop, and step while avoiding endpoint, floating-point, dtype, and memory mistakes.<\/p>\n","protected":false},"author":28,"featured_media":33664,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1495],"tags":[5309,5314,5311,5313,5310],"class_list":["post-23500","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-numpy","tag-arange-in-python","tag-linspace-vs-arange","tag-np-arange-function","tag-np-arange-vs-range","tag-numpy-arange-include-endpoint","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>NumPy arange(): Start, Stop, Step, and Examples<\/title>\n<meta name=\"description\" content=\"Use NumPy arange() with start, stop, step, dtype, negative ranges, reshape(), floating steps, and linspace() endpoint differences.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"NumPy arange(): Start, Stop, Step, and Examples\" \/>\n<meta property=\"og:description\" content=\"Build NumPy ranges with start, stop, and step while avoiding endpoint, floating-point, dtype, and memory mistakes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/numpy-arange\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-20T06:47:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-13T07:10:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-range-grid.png\" \/>\n<meta name=\"author\" content=\"Vishnu Venkatesh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Python Pool\" \/>\n<meta name=\"twitter:description\" content=\"Practical Python tutorials, error fixes, code examples, and project guides.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-range-grid.png\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishnu Venkatesh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/\"},\"author\":{\"name\":\"Vishnu Venkatesh\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/person\\\/5e8aa48e7557450d345c829305550688\"},\"headline\":\"NumPy arange(): Start, Stop, Step, and Examples\",\"datePublished\":\"2022-07-20T06:47:33+00:00\",\"dateModified\":\"2026-07-13T07:10:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/\"},\"wordCount\":983,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/numpy-arange-guide-pythonpool.png\",\"keywords\":[\"arange in python\",\"linspace vs arange\",\"np arange function\",\"np arange vs range\",\"numpy arange include endpoint\"],\"articleSection\":[\"Numpy\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/\",\"name\":\"NumPy arange(): Start, Stop, Step, and Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/numpy-arange-guide-pythonpool.png\",\"datePublished\":\"2022-07-20T06:47:33+00:00\",\"dateModified\":\"2026-07-13T07:10:30+00:00\",\"description\":\"Use NumPy arange() with start, stop, step, dtype, negative ranges, reshape(), floating steps, and linspace() endpoint differences.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/numpy-arange-guide-pythonpool.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/numpy-arange-guide-pythonpool.png\",\"width\":1350,\"height\":650,\"caption\":\"NumPy arange function examples guide\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/numpy-arange\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pythonpool.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"NumPy arange(): Start, Stop, Step, and Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/\",\"name\":\"Python Pool\",\"description\":\"Practical Python tutorials, error fixes, code examples, and project guides.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pythonpool.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/aa.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/pythonpool\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#\\\/schema\\\/person\\\/5e8aa48e7557450d345c829305550688\",\"name\":\"Vishnu Venkatesh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g\",\"caption\":\"Vishnu Venkatesh\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"NumPy arange(): Start, Stop, Step, and Examples","description":"Use NumPy arange() with start, stop, step, dtype, negative ranges, reshape(), floating steps, and linspace() endpoint differences.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonpool.com\/numpy-arange\/","og_locale":"en_US","og_type":"article","og_title":"NumPy arange(): Start, Stop, Step, and Examples","og_description":"Build NumPy ranges with start, stop, and step while avoiding endpoint, floating-point, dtype, and memory mistakes.","og_url":"https:\/\/www.pythonpool.com\/numpy-arange\/","og_site_name":"Python Pool","article_published_time":"2022-07-20T06:47:33+00:00","article_modified_time":"2026-07-13T07:10:30+00:00","og_image":[{"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-range-grid.png","type":"","width":"","height":""}],"author":"Vishnu Venkatesh","twitter_card":"summary_large_image","twitter_title":"Python Pool","twitter_description":"Practical Python tutorials, error fixes, code examples, and project guides.","twitter_image":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-range-grid.png","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Vishnu Venkatesh","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/"},"author":{"name":"Vishnu Venkatesh","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/5e8aa48e7557450d345c829305550688"},"headline":"NumPy arange(): Start, Stop, Step, and Examples","datePublished":"2022-07-20T06:47:33+00:00","dateModified":"2026-07-13T07:10:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/"},"wordCount":983,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-guide-pythonpool.png","keywords":["arange in python","linspace vs arange","np arange function","np arange vs range","numpy arange include endpoint"],"articleSection":["Numpy"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/numpy-arange\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/","url":"https:\/\/www.pythonpool.com\/numpy-arange\/","name":"NumPy arange(): Start, Stop, Step, and Examples","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-guide-pythonpool.png","datePublished":"2022-07-20T06:47:33+00:00","dateModified":"2026-07-13T07:10:30+00:00","description":"Use NumPy arange() with start, stop, step, dtype, negative ranges, reshape(), floating steps, and linspace() endpoint differences.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/numpy-arange\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-guide-pythonpool.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/numpy-arange-guide-pythonpool.png","width":1350,"height":650,"caption":"NumPy arange function examples guide"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"NumPy arange(): Start, Stop, Step, and Examples"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Practical Python tutorials, error fixes, code examples, and project guides.","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/5e8aa48e7557450d345c829305550688","name":"Vishnu Venkatesh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8d399a4488a19871b08a11ebd884e233b04c76d12edc4c7278a79d69df853d75?s=96&d=wavatar&r=g","caption":"Vishnu Venkatesh"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/23500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=23500"}],"version-history":[{"count":45,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/23500\/revisions"}],"predecessor-version":[{"id":41893,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/23500\/revisions\/41893"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/33664"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=23500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=23500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=23500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}