{"id":13184,"date":"2021-06-06T08:30:35","date_gmt":"2021-06-06T03:00:35","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=13184"},"modified":"2021-06-06T08:30:38","modified_gmt":"2021-06-06T03:00:38","slug":"numpy-ix_","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/numpy-ix_\/","title":{"rendered":"Numpy ix_ Function: Things You Need to Know"},"content":{"rendered":"\n<p>The numpy library in python is used for working with multi-dimensional arrays and matrices while performing logical and mathematical operations on them. In addition, Numpy is the fundamental library for performing all types of scientific computations in python. This article will be learning about a function in numpy, which is the <em><strong>numpy ix<\/strong><\/em> function.<\/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-ix_\/#What_is_numpy_ix_function\" >What is numpy ix function?<\/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-ix_\/#Syntax_of_numpy_ix_function\" >Syntax of numpy ix function<\/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-ix_\/#Parameter\" >Parameter:<\/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-ix_\/#Return_Value_of_numpy_ix_function\" >Return Value of numpy ix function<\/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-ix_\/#Numpy_ix_in_Python\" >Numpy ix_ in Python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/numpy-ix_\/#Obtaining_tuple_from_numpyix\" >Obtaining tuple from numpy.ix_()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/numpy-ix_\/#Using_the_obtained_tuple_as_an_array_index\" >Using the obtained tuple as an array index<\/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-ix_\/#Passing_boolean_values_to_numpy_ix_function\" >Passing boolean values to numpy ix function<\/a><\/li><\/ul><\/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-ix_\/#FAQs_on_numpy_ix\" >FAQ&#8217;s on numpy ix<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-numpy-ix-function\"><span class=\"ez-toc-section\" id=\"What_is_numpy_ix_function\"><\/span>What is numpy ix function?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>The numpy <em>ix<\/em> function in python is used for constructing open mesh from multiple sequences. The function takes N number of one-dimensional sequences, and as the output, it returns N number of N dimension sequences. The main purpose of the numpy <em>ix <\/em>function is for slicing arrays. We can use the <em>ix<\/em> function as an index to a given array.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-syntax-of-numpy-ix-function\"><span class=\"ez-toc-section\" id=\"Syntax_of_numpy_ix_function\"><\/span>Syntax of numpy ix function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The syntax for the <em>ix<\/em> function in numpy is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>numpy.ix_(*args)<\/em><\/pre>\n\n\n\n<p>The function accepts only one argument which is the N dimensional array. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-parameter\"><span class=\"ez-toc-section\" id=\"Parameter\"><\/span>Parameter:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>args<\/strong>: It is the N number of one-dimensional sequence(s). The sequence can be of either boolean or integer type. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-return-value-of-numpy-ix-function\"><span class=\"ez-toc-section\" id=\"Return_Value_of_numpy_ix_function\"><\/span>Return Value of numpy ix function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>out<\/strong> : The output of the <em>numpy ix<\/em> function is a tuple of n dimensional arrays. The N number of arrays with N dimensions together form an open mesh.  <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>By using numpy<em> ix,<\/em> we can index arrays by passing the output of the function as an index to the array. <em>ix<\/em> will construct index arrays that will index the cross <span style=\"text-decoration: underline;\"><a href=\"http:\/\/www.pythonpool.com\/numpy-dot-product\/\" target=\"_blank\" rel=\"noreferrer noopener\">product<\/a><\/span>. Let us understand the function by implementing it in python.<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-numpy-ix_-in-python\"><span class=\"ez-toc-section\" id=\"Numpy_ix_in_Python\"><\/span>Numpy ix_ in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-obtaining-tuple-from-numpy-ix_\"><span class=\"ez-toc-section\" id=\"Obtaining_tuple_from_numpyix\"><\/span>Obtaining tuple from numpy.ix_()<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>For using the <em>ix<\/em> function, we will first have to import the numpy library.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\n<\/pre><\/div>\n\n\n<p>Now, we will call the <em>ix <\/em>function using np.ix_(), and we shall pass 2 one dimensional arrays as an argument to the function. Finally, we shall assign the output of the function to the variable <em>ix_tuple<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nix_tuple = np.ix_(&#x5B;1,0],&#x5B;2,3])\n<\/pre><\/div>\n\n\n<p>Let us print the type of the variable <em>ix_tuple<\/em>. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nprint(type(ix_tuple))\n<\/pre><\/div>\n\n\n<p><strong>The output is:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;class 'tuple'&gt;<\/pre>\n\n\n\n<p>So it is clear that the <em>numpy ix_() <\/em>function returns <a href=\"http:\/\/www.pythonpool.com\/tuple-comprehension\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"text-decoration: underline;\">tuple<\/span><\/a> as the output. Now, we shall print the tuple <em>&#8216;ix_tuple&#8217;<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nprint(ix_tuple)\n<\/pre><\/div>\n\n\n<p><strong>The output is:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">(array([[1],\n       [0]]), array([[2, 3]]))<\/pre>\n\n\n\n<p>It returns two 1 dimensional arrays wrapped in a single tuple. Now we shall try to <a href=\"http:\/\/www.pythonpool.com\/python-pass\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"text-decoration: underline;\">pass<\/span><\/a> this tuple as an index to a given array so as to use it as an index. But first, let us create an array.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-using-the-obtained-tuple-as-an-array-index\"><span class=\"ez-toc-section\" id=\"Using_the_obtained_tuple_as_an_array_index\"><\/span>Using the obtained tuple as an array index<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>To create an array, we will make use of two functions: the <em>arange()<\/em> and the <em>reshape()<\/em> function. <\/strong><\/p>\n\n\n\n<p><strong><em>arange()<\/em> <\/strong>is a function present in the numpy library. It creates an object of N dimensional array containing values in the given interval. <\/p>\n\n\n\n<p><strong><em>reshape()<\/em> <\/strong>function is used for shaping a given array of values into the mentioned space size. To use it as a method, we use the syntax <em>ndarray.reshape()<\/em>. <\/p>\n\n\n\n<p>Here, we will create an array containing values from 0 &#8211; 7. So, we will pass 8 as an argument to the <em>arange() function where the value 8 is exclusive. For the array size, we want it to be an array containing 2 rows and 4 columns. So, we pass 2 and 4 as an argument<\/em> for the <em>reshape()<\/em> method.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\narray = np.arange(8).reshape(2, 4)\nprint(array)\n<\/pre><\/div>\n\n\n<p><strong>The array created is:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;&#x5B;0 1 2 3]\n &#x5B;4 5 6 7]]\n<\/pre><\/div>\n\n\n<p><br>Now, we shall use the<em> ix_tuple<\/em> as the index to the array &#8216;array&#8217; and access the respective elements.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\narray&#x5B;ix_tuple]\n<\/pre><\/div>\n\n\n<p><strong>The output is:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array([[6, 7],\n       [2, 3]])<\/pre>\n\n\n\n<p><strong>Our ix_tuple was : (array([[1], [0]]), array([[2, 3]])) and our array was : <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[[0 1 2 3]<br>[4 5 6 7]]<\/pre>\n\n\n\n<p>The cross product of the ix_tuple accesses the array. The subarray was selected by taking <em>1 and 0 as the rows<\/em> and <em>2 and 3 as the columns.<\/em> Therefore, the indexes returned are (1,2), (1,3), (0,2) and (0,3). In the array, <\/p>\n\n\n\n<p><strong>( 1 , 2 ) denotes element 6,                                                                                                            ( 1 , 3 ) denotes element 7,                                                                                                                            ( 0 , 2 ) denotes element 2.                                                                                                                              ( 0 , 3 ) denotes element 3. <\/strong><\/p>\n\n\n\n<p><strong>So the elements are printed accordingly. <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"727\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21-1024x727.png\" alt=\"Numpy Ix_\" class=\"wp-image-13190\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21-1024x727.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21-300x213.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21-768x545.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21-1536x1090.png 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/image-21.png 1678w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-passing-boolean-values-to-numpy-ix-function\"><span class=\"ez-toc-section\" id=\"Passing_boolean_values_to_numpy_ix_function\"><\/span>Passing boolean values to numpy ix function<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We can also pass boolean values as arguments to the ix function. Here, for the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Matrix_(mathematics)#:~:text=Matrices%20with%20a%20single%20row,is%20called%20an%20infinite%20matrix.\" target=\"_blank\" rel=\"noreferrer noopener\">row<\/a> value, we will be passing [ True, True ] instead of [ 1, 0 ] in the above example. Since we passed [ True, True ], we will get the array [ 0 , 1 ]. We shall only count the values which have been marked as true. For false, none will be passed. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nix_tuple = np.ix_(&#x5B;True,True],&#x5B;2,3])\nprint(ix_tuple)\n<\/pre><\/div>\n\n\n<p>The ix_tuple would be:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n(array(&#x5B;&#x5B;0],\n       &#x5B;1]]), array(&#x5B;&#x5B;2, 3]]))\n<\/pre><\/div>\n\n\n<p>So, on passing the<em> ix_tuple<\/em> as the index to the same array<em> &#8216;array&#8217;<\/em>, we will get the same values, but their order would be changed.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\narray(&#x5B;&#x5B;2, 3],\n       &#x5B;6, 7]])\n<\/pre><\/div>\n\n\n<p><strong>The array generated would be : <\/strong><\/p>\n\n\n\n<p><strong>( 0 , 2 ) denotes element 2,                                                                                                          ( 0 , 3 ) denotes element 3,                                                                                                          ( 1 , 2 ) denotes element 6,                                                                                                             ( 1 , 3 ) denotes element 7.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faq-s-on-numpy-ix\"><span class=\"ez-toc-section\" id=\"FAQs_on_numpy_ix\"><\/span>FAQ&#8217;s on numpy ix<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-1622876804480\"><strong class=\"schema-faq-question\">What is <em>&#8216;IndexError: index is out of bounds&#8217; <\/em>error ?<br\/><\/strong> <p class=\"schema-faq-answer\">The <em>&#8216;IndexError: index is out of bounds&#8217;<\/em> error can occur while using the <em>numpy.ix_()<\/em> function. It occurs when the indexes mentioned in the tuple does not match with the size of the array you are indexing. Because of that, the index goes out of bounds of the array so the above error is thrown. <\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1622902426913\"><strong class=\"schema-faq-question\">What is <em>&#8216;valueerror : cross index must be 1 dimensional&#8217; <\/em>error ?<br\/><\/strong> <p class=\"schema-faq-answer\"><em>&#8216;valueerror : cross index must be 1 dimensional&#8217;<\/em> is raised when you try to pass a multi dimensional array as an argument to the <em>numpy.ix()<\/em> function. This is because the function only accepts one dimensional array and will raise an error otherwise. <\/p> <\/div> <\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p>That sums up Numpy ix function. If you have any questions in mind, let us know in the comments below.<\/p>\n\n\n\n<p><em>Until then, Keep Learning!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The numpy library in python is used for working with multi-dimensional arrays and matrices while performing logical and mathematical operations on them. In addition, Numpy &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Numpy ix_ Function: Things You Need to Know\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/numpy-ix_\/#more-13184\" aria-label=\"More on Numpy ix_ Function: Things You Need to Know\">Read more<\/a><\/p>\n","protected":false},"author":20,"featured_media":13217,"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":[4174,4173,4175],"class_list":["post-13184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-numpy","tag-ix_-numpy","tag-numpy-ix_","tag-numpy-ix_-example","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>Numpy ix_ Function: Things You Need to Know - Python Pool<\/title>\n<meta name=\"description\" content=\"The numpy ix_ function takes N number of one dimensional sequences and as the output, it returns N number of N dimension sequences.\" \/>\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-ix_\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Numpy ix_ Function: Things You Need to Know\" \/>\n<meta property=\"og:description\" content=\"The numpy library in python is used for working with multi-dimensional arrays and matrices while performing logical and mathematical operations on them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/numpy-ix_\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-06T03:00:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-06T03:00:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Dhruvi Vikma\" \/>\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=\"Dhruvi Vikma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/\"},\"author\":{\"name\":\"Dhruvi Vikma\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/bed8fc40c7b71baf7d76b1cfefd79f23\"},\"headline\":\"Numpy ix_ Function: Things You Need to Know\",\"datePublished\":\"2021-06-06T03:00:35+00:00\",\"dateModified\":\"2021-06-06T03:00:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/\"},\"wordCount\":850,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg\",\"keywords\":[\"ix_ numpy\",\"numpy ix_\",\"numpy ix_ example\"],\"articleSection\":[\"Numpy\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/numpy-ix_\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/\",\"url\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/\",\"name\":\"Numpy ix_ Function: Things You Need to Know - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg\",\"datePublished\":\"2021-06-06T03:00:35+00:00\",\"dateModified\":\"2021-06-06T03:00:38+00:00\",\"description\":\"The numpy ix_ function takes N number of one dimensional sequences and as the output, it returns N number of N dimension sequences.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480\"},{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/numpy-ix_\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg\",\"width\":1350,\"height\":650,\"caption\":\"numpy ix_\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Numpy ix_ Function: Things You Need to Know\"}]},{\"@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\/bed8fc40c7b71baf7d76b1cfefd79f23\",\"name\":\"Dhruvi Vikma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/520d8a37e8b6ce4e6df57e997dc0d571225f48098bbb02838c3884bb603e886f?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/520d8a37e8b6ce4e6df57e997dc0d571225f48098bbb02838c3884bb603e886f?s=96&d=wavatar&r=g\",\"caption\":\"Dhruvi Vikma\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480\",\"position\":1,\"url\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480\",\"name\":\"What is 'IndexError: index is out of bounds' error ?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The <em>'IndexError: index is out of bounds'<\/em> error can occur while using the <em>numpy.ix_()<\/em> function. It occurs when the indexes mentioned in the tuple does not match with the size of the array you are indexing. Because of that, the index goes out of bounds of the array so the above error is thrown. \",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913\",\"position\":2,\"url\":\"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913\",\"name\":\"What is 'valueerror : cross index must be 1 dimensional' error ?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<em>'valueerror : cross index must be 1 dimensional'<\/em> is raised when you try to pass a multi dimensional array as an argument to the <em>numpy.ix()<\/em> function. This is because the function only accepts one dimensional array and will raise an error otherwise. \",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Numpy ix_ Function: Things You Need to Know - Python Pool","description":"The numpy ix_ function takes N number of one dimensional sequences and as the output, it returns N number of N dimension sequences.","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-ix_\/","og_locale":"en_US","og_type":"article","og_title":"Numpy ix_ Function: Things You Need to Know","og_description":"The numpy library in python is used for working with multi-dimensional arrays and matrices while performing logical and mathematical operations on them.","og_url":"https:\/\/www.pythonpool.com\/numpy-ix_\/","og_site_name":"Python Pool","article_published_time":"2021-06-06T03:00:35+00:00","article_modified_time":"2021-06-06T03:00:38+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg","type":"image\/jpeg"}],"author":"Dhruvi Vikma","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Dhruvi Vikma","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/"},"author":{"name":"Dhruvi Vikma","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/bed8fc40c7b71baf7d76b1cfefd79f23"},"headline":"Numpy ix_ Function: Things You Need to Know","datePublished":"2021-06-06T03:00:35+00:00","dateModified":"2021-06-06T03:00:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/"},"wordCount":850,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg","keywords":["ix_ numpy","numpy ix_","numpy ix_ example"],"articleSection":["Numpy"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/numpy-ix_\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/","url":"https:\/\/www.pythonpool.com\/numpy-ix_\/","name":"Numpy ix_ Function: Things You Need to Know - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg","datePublished":"2021-06-06T03:00:35+00:00","dateModified":"2021-06-06T03:00:38+00:00","description":"The numpy ix_ function takes N number of one dimensional sequences and as the output, it returns N number of N dimension sequences.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480"},{"@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/numpy-ix_\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/06\/Numpy-ix_-Function-Things-You-Need-to-Know.jpg","width":1350,"height":650,"caption":"numpy ix_"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Numpy ix_ Function: Things You Need to Know"}]},{"@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\/bed8fc40c7b71baf7d76b1cfefd79f23","name":"Dhruvi Vikma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/520d8a37e8b6ce4e6df57e997dc0d571225f48098bbb02838c3884bb603e886f?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/520d8a37e8b6ce4e6df57e997dc0d571225f48098bbb02838c3884bb603e886f?s=96&d=wavatar&r=g","caption":"Dhruvi Vikma"}},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480","position":1,"url":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622876804480","name":"What is 'IndexError: index is out of bounds' error ?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The <em>'IndexError: index is out of bounds'<\/em> error can occur while using the <em>numpy.ix_()<\/em> function. It occurs when the indexes mentioned in the tuple does not match with the size of the array you are indexing. Because of that, the index goes out of bounds of the array so the above error is thrown. ","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913","position":2,"url":"https:\/\/www.pythonpool.com\/numpy-ix_\/#faq-question-1622902426913","name":"What is 'valueerror : cross index must be 1 dimensional' error ?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"<em>'valueerror : cross index must be 1 dimensional'<\/em> is raised when you try to pass a multi dimensional array as an argument to the <em>numpy.ix()<\/em> function. This is because the function only accepts one dimensional array and will raise an error otherwise. ","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/13184","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\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=13184"}],"version-history":[{"count":25,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/13184\/revisions"}],"predecessor-version":[{"id":13220,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/13184\/revisions\/13220"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/13217"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=13184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=13184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=13184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}