{"id":23500,"date":"2022-07-20T12:17:33","date_gmt":"2022-07-20T06:47:33","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=23500"},"modified":"2022-07-20T12:20:12","modified_gmt":"2022-07-20T06:50:12","slug":"numpy-arange","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/numpy-arange\/","title":{"rendered":"The Numpy arange Function and Including Endpoints"},"content":{"rendered":"\n<p>In this article, we will be discussing NumPy arange function and including endpoints. The NumPy module (Numerical Python) is used for working with arrays. A vital data type in Numpy is a ndarray. It has functions for working on various domains in mathematics. <\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 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\/#What_is_arange\" >What is arange?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Function_Syntax_Parameters\" >Function Syntax &amp; Parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Returns\" >Returns<\/a><\/li><\/ul><\/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\/#Creating_an_Array_Using_NumPy_arange\" >Creating an Array Using NumPy arange<\/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\/#Does_NumPy_arange_Include_Endpoints\" >Does NumPy arange Include Endpoints?<\/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\/#Including_Endpoints_In_Numpy_arange_Function\" >Including Endpoints In Numpy arange Function<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Example_1\" >Example 1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Example_2\" >Example 2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Example_3\" >Example 3<\/a><\/li><\/ul><\/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\/#Alternatives_to_NumPy_arange_Function\" >Alternatives to NumPy arange Function<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Using_numpylinspace\" >Using numpy.linspace()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Using_numpyogrid\" >Using numpy.ogrid()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Using_numpymgrid\" >Using numpy.mgrid()<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#FAQs_on_numpyarange\" >FAQs on numpy.arange()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#Trending_Python_Articles\" >Trending Python Articles<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-arange\"><span class=\"ez-toc-section\" id=\"What_is_arange\"><\/span>What is arange?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To create an array conditional to numerical procedures in Python <code>np.arange()<\/code> is used. The&nbsp;<code>numpy.arange()<\/code>&nbsp;function returns a NumPy array object&nbsp;with spaced elements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-function-syntax-parameters\"><span class=\"ez-toc-section\" id=\"Function_Syntax_Parameters\"><\/span>Function Syntax &amp; Parameters<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>np.arange([start],[stop],[step],[dtype]<\/code>)<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>start<\/strong> &#8211; Indicates the start of the interval. Optional parameter with a default value of 0.<\/li><li><strong>stop<\/strong> &#8211; End of the interval <span style=\"text-decoration: underline;\"><strong><a href=\"http:\/\/www.pythonpool.com\/python-range-inclusive\/\" target=\"_blank\" rel=\"noreferrer noopener\">range<\/a><\/strong><\/span>.<\/li><li><strong>step<\/strong> &#8211; Represents the size of the interval. Optional parameter with a default value of 1<\/li><li><strong>dtype<\/strong> &#8211; Describes the data type of the output array. <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-returns\"><span class=\"ez-toc-section\" id=\"Returns\"><\/span>Returns<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Returns a NumPy array of evenly spaced values. The length of the output array is Ceil((Stop-Start) \/ Step)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-creating-an-array-using-numpy-arange\"><span class=\"ez-toc-section\" id=\"Creating_an_Array_Using_NumPy_arange\"><\/span>Creating an Array Using NumPy arange<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s look at how we can use this function to create a NumPy array of evenly spaced values. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\n\nmyArray = np.arange(start=0, stop=12, step=3)\nprint(myArray)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[0 3 6 9]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-does-numpy-arange-include-endpoints\"><span class=\"ez-toc-section\" id=\"Does_NumPy_arange_Include_Endpoints\"><\/span>Does NumPy arange Include Endpoints?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>NumPy <code>arange()<\/code> <strong>does not<\/strong> include the endpoint. However, the MatLab equivalent does have an endpoint. In Python Numpy, the array is always one element short. <\/p>\n\n\n\n<p>Why is this a feature?<\/p>\n\n\n\n<p>In programming, it is more common to call <code>arange(0,10)<\/code> which returns 10 elements <code>[1,2,3,4,5,6,7,8,9]<\/code>. In Python, 0-based indexing is implemented, which means 0 is considered an element. <\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-kilo monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Popular now<\/span><span class=\"monsterinsights-inline-popular-posts-border\" ><\/span><span class=\"monsterinsights-inline-popular-posts-border-2\" ><\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\">[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-including-endpoints-in-numpy-arange-function\"><span class=\"ez-toc-section\" id=\"Including_Endpoints_In_Numpy_arange_Function\"><\/span>Including Endpoints In Numpy arange Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s look at some implementations that include the endpoint in <code>arange()<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-1\"><span class=\"ez-toc-section\" id=\"Example_1\"><\/span>Example 1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Increase the upper bound limit by 1 value. Initially, <code>np.arange()<\/code> does not include the endpoint. By increasing your upper value, the endpoint is obtained. The following program will attempt to create an array of elements from 1 &#8211; 10.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\n\nmyArray = np.arange(start=0, stop=11, step=2)\nprint(myArray)\n<\/pre><\/div>\n\n\n<p><strong>Output 1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[0 2 4 6 8 10]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-2\"><span class=\"ez-toc-section\" id=\"Example_2\"><\/span>Example 2<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Another solution is to include the endpoint in <code>arange()<\/code> is to create your own arange function like so:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\n\ndef EParange(start, end):\n  return np.arange(start, end+1)\n\nEParange(1,10)     \n<\/pre><\/div>\n\n\n<p><strong>Output 2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-3\"><span class=\"ez-toc-section\" id=\"Example_3\"><\/span>Example 3<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Similar to Example 2, we can create a function like so:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\n\ndef EParange(start, end):\n  return np.arange(start, end)\n\nEParange(1,11)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<p>array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])<\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-juliett monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-image\"><a href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined.webp 1200w \" alt=\"[Fixed] nameerror: name Unicode is not defined\" \/><\/a><\/div><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><span class=\"monsterinsights-inline-popular-posts-border\" ><\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\">[Fixed] nameerror: name Unicode is not defined<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-alternatives-to-numpy-arange-function\"><span class=\"ez-toc-section\" id=\"Alternatives_to_NumPy_arange_Function\"><\/span>Alternatives to NumPy arange Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-using-numpy-linspace\"><span class=\"ez-toc-section\" id=\"Using_numpylinspace\"><\/span>Using numpy.linspace()<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The step value in <code>arange()<\/code> only takes integer arguments. Let&#8217;s see how we can create a step value of decimal increments. <\/p>\n\n\n\n<p>In <code>arange()<\/code>assigning the step value as decimals may result in inaccurate values. Therefore, it is better to use <code>.linspace()<\/code> function in this scenario. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\ndecimalArray = np.linspace(0.5, 1.0, 6)\nprint(decimalArray)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[0.5 0.6 0.7 0.8 0.9 1. ]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-using-numpy-ogrid\"><span class=\"ez-toc-section\" id=\"Using_numpyogrid\"><\/span>Using numpy.ogrid()<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><code>ogrid<\/code> or&nbsp;&#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Simple_API_for_Grid_Applications\">open grid<\/a>&#8221;&nbsp;allow you to operate on specific pixels of an image based on row and column indexes.<\/p>\n\n\n\n<p>Let&#8217;s see how we can create an array using <code>.ogrid()<\/code><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\nmyArray = np.ogrid&#x5B;0:10]\nprint(myArray)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[0 1 2 3 4 5 6 7 8 9]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-using-numpy-mgrid\"><span class=\"ez-toc-section\" id=\"Using_numpymgrid\"><\/span>Using numpy.mgrid()<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>mgrid()<\/code> function returns a multi-dimensional &#8216;mesh grid&#8217;. <\/p>\n\n\n\n<p>The dimensions of the output arrays are equivalent to the number of the indexed dimensions.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\nmyArray = np.mgrid&#x5B;1:7, 1:7]\nprint(myArray)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[[[1 1 1 1 1 1]\n  [2 2 2 2 2 2]\n  [3 3 3 3 3 3]\n  [4 4 4 4 4 4]\n  [5 5 5 5 5 5]\n  [6 6 6 6 6 6]]\n\n [[1 2 3 4 5 6]\n  [1 2 3 4 5 6]\n  [1 2 3 4 5 6]\n  [1 2 3 4 5 6]\n  [1 2 3 4 5 6]\n  [1 2 3 4 5 6]]]<\/pre>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-alpha monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\">[Solved] runtimeerror: cuda error: invalid device ordinal<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faqs-on-numpy-arange\"><span class=\"ez-toc-section\" id=\"FAQs_on_numpyarange\"><\/span>FAQs on numpy.arange()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1658036326694\"><strong class=\"schema-faq-question\">How to change the data type in NumPy arange()?<\/strong> <p class=\"schema-faq-answer\">The <code>dtype<\/code> parameter allows you to change the data type of the output array.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1658036368866\"><strong class=\"schema-faq-question\">Does the NumPy arange() include endpoints?<\/strong> <p class=\"schema-faq-answer\">The <code>arange()<\/code> function does not include endpoints. This is because most Python functions follow 0-based indexing. This means the 0th value is taken into account.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1658036538184\"><strong class=\"schema-faq-question\">Does the Python range function include endpoints?<\/strong> <p class=\"schema-faq-answer\"><code>range()<\/code> generates numbers up to the end number but never includes it in its results because it generates numbers up to the endpoint only. This is similar to the above FAQ, and Python follows 0-based indexing.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1658036962421\"><strong class=\"schema-faq-question\"><strong>How to use array_like in NumPy arange?<\/strong><\/strong> <p class=\"schema-faq-answer\"><code>array_like<\/code> parameter creates a reference object that allows us to create arrays that are not NumPy arrays. It guarantees the creation of an array object that&#8217;s compatible with the array passed through this parameter.  <\/p> <\/div> <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we&#8217;ve looked at the NumPy module and its arange function. Different implementations to include the endpoint have been reviewed. The reason why most Python functions do not include an endpoint has been mentioned. Alternatives to arange function have been demonstrated.<\/p>\n\n\n<div class=\"monsterinsights-widget-popular-posts monsterinsights-widget-popular-posts-delta monsterinsights-popular-posts-styled monsterinsights-widget-popular-posts-columns-2\"><h2 class=\"monsterinsights-widget-popular-posts-widget-title\"><span class=\"ez-toc-section\" id=\"Trending_Python_Articles\"><\/span>Trending Python Articles<span class=\"ez-toc-section-end\"><\/span><\/h2><ul class=\"monsterinsights-widget-popular-posts-list\"><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_.webp 1200w \" alt=\"[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 11, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined.webp 1200w \" alt=\"[Fixed] nameerror: name Unicode is not defined\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] nameerror: name Unicode is not defined<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal.webp 1200w \" alt=\"[Solved] runtimeerror: cuda error: invalid device ordinal\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Solved] runtimeerror: cuda error: invalid device ordinal<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-type-numpy-ndarray-doesnt-define-__round__-method\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method.webp 1200w \" alt=\"[Fixed] typeerror: type numpy.ndarray doesn&#8217;t define __round__ method\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] typeerror: type numpy.ndarray doesn&#8217;t define __round__ method<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><\/ul><\/div><p><\/p>","protected":false},"excerpt":{"rendered":"<p>In this article, we will be discussing NumPy arange function and including endpoints. The NumPy module (Numerical Python) is used for working with arrays. A &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"The Numpy arange Function and Including Endpoints\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/numpy-arange\/#more-23500\" aria-label=\"More on The Numpy arange Function and Including Endpoints\">Read more<\/a><\/p>\n","protected":false},"author":28,"featured_media":23554,"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 v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Numpy arange Function and Including Endpoints - Python Pool<\/title>\n<meta name=\"description\" content=\"In this article we will be discussing about numpy arange and including endpoints. The NumPy module is used for working with arrays\" \/>\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=\"The Numpy arange Function and Including Endpoints\" \/>\n<meta property=\"og:description\" content=\"In this article, we will be discussing NumPy arange function and including endpoints. The NumPy module (Numerical Python) is used for working with arrays.\" \/>\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=\"2022-07-20T06:50:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/07\/Numpy-arange.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Vishnu Venkatesh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\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\":\"The Numpy arange Function and Including Endpoints\",\"datePublished\":\"2022-07-20T06:47:33+00:00\",\"dateModified\":\"2022-07-20T06:50:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/\"},\"wordCount\":609,\"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\/2022\/07\/Numpy-arange.webp\",\"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\",\"FAQPage\"],\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/\",\"url\":\"https:\/\/www.pythonpool.com\/numpy-arange\/\",\"name\":\"The Numpy arange Function and Including Endpoints - Python Pool\",\"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\/2022\/07\/Numpy-arange.webp\",\"datePublished\":\"2022-07-20T06:47:33+00:00\",\"dateModified\":\"2022-07-20T06:50:12+00:00\",\"description\":\"In this article we will be discussing about numpy arange and including endpoints. The NumPy module is used for working with arrays\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694\"},{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866\"},{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184\"},{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421\"}],\"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\/2022\/07\/Numpy-arange.webp\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/07\/Numpy-arange.webp\",\"width\":1200,\"height\":628,\"caption\":\"Numpy arange\"},{\"@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\":\"The Numpy arange Function and Including Endpoints\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"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\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/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:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"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\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694\",\"position\":1,\"url\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694\",\"name\":\"How to change the data type in NumPy arange()?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The dtype parameter allows you to change the data type of the output array.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866\",\"position\":2,\"url\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866\",\"name\":\"Does the NumPy arange() include endpoints?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The arange() function does not include endpoints. This is because most Python functions follow 0-based indexing. This means the 0th value is taken into account.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184\",\"position\":3,\"url\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184\",\"name\":\"Does the Python range function include endpoints?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"range() generates numbers up to the end number but never includes it in its results because it generates numbers up to the endpoint only. This is similar to the above FAQ, and Python follows 0-based indexing.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421\",\"position\":4,\"url\":\"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421\",\"name\":\"How to use array_like in NumPy arange?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"array_like parameter creates a reference object that allows us to create arrays that are not NumPy arrays. It guarantees the creation of an array object that's compatible with the array passed through this parameter.  \",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Numpy arange Function and Including Endpoints - Python Pool","description":"In this article we will be discussing about numpy arange and including endpoints. The NumPy module is used for working with arrays","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":"The Numpy arange Function and Including Endpoints","og_description":"In this article, we will be discussing NumPy arange function and including endpoints. The NumPy module (Numerical Python) is used for working with arrays.","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":"2022-07-20T06:50:12+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/07\/Numpy-arange.webp","type":"image\/webp"}],"author":"Vishnu Venkatesh","twitter_card":"summary_large_image","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":"The Numpy arange Function and Including Endpoints","datePublished":"2022-07-20T06:47:33+00:00","dateModified":"2022-07-20T06:50:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/"},"wordCount":609,"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\/2022\/07\/Numpy-arange.webp","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","FAQPage"],"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/","url":"https:\/\/www.pythonpool.com\/numpy-arange\/","name":"The Numpy arange Function and Including Endpoints - Python Pool","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\/2022\/07\/Numpy-arange.webp","datePublished":"2022-07-20T06:47:33+00:00","dateModified":"2022-07-20T06:50:12+00:00","description":"In this article we will be discussing about numpy arange and including endpoints. The NumPy module is used for working with arrays","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694"},{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866"},{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184"},{"@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421"}],"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\/2022\/07\/Numpy-arange.webp","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/07\/Numpy-arange.webp","width":1200,"height":628,"caption":"Numpy arange"},{"@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":"The Numpy arange Function and Including Endpoints"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","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":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/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:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","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"}},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694","position":1,"url":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036326694","name":"How to change the data type in NumPy arange()?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The dtype parameter allows you to change the data type of the output array.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866","position":2,"url":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036368866","name":"Does the NumPy arange() include endpoints?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The arange() function does not include endpoints. This is because most Python functions follow 0-based indexing. This means the 0th value is taken into account.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184","position":3,"url":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036538184","name":"Does the Python range function include endpoints?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"range() generates numbers up to the end number but never includes it in its results because it generates numbers up to the endpoint only. This is similar to the above FAQ, and Python follows 0-based indexing.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421","position":4,"url":"https:\/\/www.pythonpool.com\/numpy-arange\/#faq-question-1658036962421","name":"How to use array_like in NumPy arange?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"array_like parameter creates a reference object that allows us to create arrays that are not NumPy arrays. It guarantees the creation of an array object that's compatible with the array passed through this parameter.  ","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_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":39,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/23500\/revisions"}],"predecessor-version":[{"id":23560,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/23500\/revisions\/23560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/23554"}],"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}]}}