{"id":3971,"date":"2018-08-22T17:12:09","date_gmt":"2018-08-22T11:42:09","guid":{"rendered":"https:\/\/www.csestack.org\/?p=3971"},"modified":"2019-10-25T08:56:49","modified_gmt":"2019-10-25T03:26:49","slug":"python-numpy-data-analytics-tutorial-array-operations-code","status":"publish","type":"post","link":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/","title":{"rendered":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-2912\" src=\"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg\" alt=\"Python for data science\" width=\"640\" height=\"482\" srcset=\"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg 640w, https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science-300x226.jpg 300w, https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science-600x452.jpg 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>If you dwell in Python programming or data science, you might have heard a lot about Numpy. This is the most used Python library for data analytics and data science.<\/p>\n<p>In this Numpy data analytics tutorial, I am explaining about Numpy Python module. How is it beneficial for data science? The Programming examples I am sharing here will make it more practical.<\/p>\n<p>Whether you are new to the data science or its been a long time being a data scientist, this tutorial will add value to your knowledge.<\/p>\n<p>Here is a brief outline of this tutorial.<\/p>\n<div class=\"post_container_links\">\n<p><strong>Table of Contents<\/strong><\/p>\n<ul>\n<li><a href=\"#use\">Why Numpy for Data Science? (Use)<\/a><\/li>\n<li><a href=\"#installation\">How to Install the Numpy Python Module<\/a><\/li>\n<li><a href=\"#creating-numpy-array\">How to Create Numpy Array?<\/a><\/li>\n<li><a href=\"#Arithmetic-Operations-Numpy-Array\">Basic Arithmetic Operations on Numpy Array<\/a><\/li>\n<li><a href=\"#multi-dimensional-numpy-array-matrix\">Multi-dimensional Arrays (Matrix) in Numpy<\/a><\/li>\n<li><a href=\"#Selecting-Elements-Numpy-Array\">Selecting Elements from Numpy Array\/Matrix<\/a><\/li>\n<li><a href=\"#Indexing-Slicing-Numpy-Array\">Indexing and Slicing in Numpy Array<\/a><\/li>\n<li><a href=\"#Reshape-Numpy-Array\">How to Reshape Numpy Array?<\/a><\/li>\n<li><a href=\"#Auto-Initialized-Numpy-Arrays\">Creating Auto Initialized Numpy Arrays<\/a><\/li>\n<li><a href=\"#Numpy-Mathematical-Operations-on-Matrix\">Mathematical Operations on Numpy Matrix<\/a>\n<ul>\n<li><a href=\"#Creating-Identity-Matrix-Array-Numpy\">Creating Identity Matrix Array in Numpy<\/a><\/li>\n<li><a href=\"#Scalar-Matrix-Multiplication\">Scalar Matrix Multiplication in Numpy<\/a><\/li>\n<li><a href=\"#Dot-Matrix-Multiplication\">Dot Matrix Multiplication in Numpy<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#Initialize-Numpy-Array-with-Random-Numbers\">Initialize Numpy Array with Random Numbers<\/a><\/li>\n<li><a href=\"#Explore-Numpy\">How to Explore Numpy? [Your Action]<\/a><\/li>\n<\/ul>\n<\/div>\n<p>So let&#8217;s begin.<\/p>\n<h4 id=\"use\">Why is a Numpy so useful for Data Science?<\/h4>\n<p>A few days back I attended TEDx talk about Data Science and one point that triggered me a lot-<\/p>\n<blockquote><p>The Amount of data we analyze is less than 1%.<\/p><\/blockquote>\n<p>This makes my brain spin.<\/p>\n<p>The huge amount of Data is being generated. To analyze this huge data and to parse this data into information, Data Science has to perform the crucial role.<\/p>\n<p>Python is leading its way by providing some of the very essential Python libraries for Data Science. Numpy is at the top of the list.<\/p>\n<p>Rather than answering it, in this tutorial, I am demonstrating different use cases and examples. At the end of this tutorial, you will find the answer to this question by yourself.<\/p>\n<h3 id=\"installation\">Installing the Numpy Python Module<\/h3>\n<p>Hope you have Python installed on your system. (If not, check this <a href=\"https:\/\/www.csestack.org\/getting-started-with-python-for-beginners\/\" target=\"_blank\" rel=\"noopener noreferrer\">guide for installing Python<\/a>.)<\/p>\n<p>Run the following command to install Numpy module in Python:<\/p>\n<pre>pip install numpy<\/pre>\n<p>This will install the latest version of Numpy module.<\/p>\n<p>To check if it is successfully installed, you can <a href=\"http:\/\/www.csestack.org\/python-list-installed-modules-versions-pip\/\" target=\"_blank\" rel=\"noopener noreferrer\">list all the installed Python modules<\/a> using freeze command.<\/p>\n<pre>pip freeze<\/pre>\n<p>The core strength of the Numpy Python module is its array (one or multi-dimensional array). Almost all the operations provided by Numpy module revolves around a Numpy array.<\/p>\n<p>So let&#8217;s see Numpy array&#8230;<\/p>\n<h3 id=\"creating-numpy-array\">Numpy Data Analytics Tutorial | Creating a Numpy Array<\/h3>\n<pre class=\"brush: python\">import numpy as np\r\nnumArr = np.array([21,22,23,24,25])\r\nprint(numArr,len(numArr))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[21 22 23 24 25]<\/pre>\n<p>You can also specify the <strong>type of Numpy array<\/strong>.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\nintArr = np.array([21,22,23,24,25],'int')\r\nfloatArr = np.array([21,22,23,24,25],'float')\r\nstrArr = np.array([21,22,23,24,25],'str')\r\nprint(intArr,floatArr,strArr,sep='\\n')<\/pre>\n<p>It typecasts each element in the Numpy array with the specified data type.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<pre>[21 22 23 24 25]\r\n[21. 22. 23. 24. 25.]\r\n['21' '22' '23' '24' '25']<\/pre>\n<p>Now onwards, we will be exploring different Python code using Numpy. You can not type a code in your text editor save it and then run it for each example. You will be exhausted.<\/p>\n<p>Rather, <a href=\"https:\/\/www.csestack.org\/install-use-jupyter-notebook-python-example\/\">install Jupyter and start using it<\/a>, now. Thanks me later :). It is one of the best editors for Data Science where you can run your Python code inside the browser.<\/p>\n<h3 id=\"Arithmetic-Operations-Numpy-Array\">Basic Arithmetic Operations on Numpy Array<\/h3>\n<p>There are numerous arithmetic operations are there.<\/p>\n<p>Following is a program to find the sum, mean and standard deviation for the numbers mentioned in the Numpy array.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\nfloatArr = np.array([21,22,23,24,25,21.2,147.6,23.7],'float')\r\nprint(floatArr.sum(),floatArr.mean(),floatArr.std(),sep='\\n')<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>307.5<br \/>\n38.4375<br \/>\n41.2800780492237<\/p>\n<p>This one-liner code for performing arithmetic operation saves your lot of time. And it is faster than the usual way of doing a mathematical operation\u00a0on the list.<\/p>\n<h4 id=\"multi-dimensional-numpy-array-matrix\">Multi-dimensional Arrays (Matrix) in Numpy<\/h4>\n<p>Data science is more about finding a relation between two dataset entities. Whether you need to plot a graph or want to compare elements in two datasets, you need a multi-dimensional array.<\/p>\n<p>Numy has provision for multi-dimensional arrays.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\narr=[[0,1,2,3,4],[10,11,12,13,14],[20,21,22,23,24]]\r\nintArr=np.array(arr)\r\nprint(intArr)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[ 0 1 2 3 4]\r\n[10 11 12 13 14]\r\n[20 21 22 23 24]]<\/pre>\n<p>Numpy also provides various functions for evaluating data elements in the multi-dimensional array. Going forward with this Numpy data analytics tutorial, I will share with you.<\/p>\n<h4 id=\"Selecting-Elements-Numpy-Array\">Selecting Elements from Numpy\u00a0 Array\/Matrix<\/h4>\n<p>How if you want to filter elements from the Numpy array?<\/p>\n<p>Let&#8217;s take an Example:<\/p>\n<p><strong>Write a Program to Select all the elements in the Matrix which are divisible by 2.<\/strong><\/p>\n<p>Mark each element in the Numpy array as 1 if it is even, otherwise marks it as 0 (odd).<\/p>\n<p>You can simply do it by mentioning your filter expression.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\nnumArr=np.array([[0,1,2,3,4],[10,11,12,13,14],[20,21,22,23,24]])\r\nprint(np.where(numArr%2==0,1,0))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[1, 0, 1, 0, 1],\r\n[1, 0, 1, 0, 1],\r\n[1, 0, 1, 0, 1]]<\/pre>\n<p>If you look at the above example, you don&#8217;t need to loop over each element in the array. This is what the Numpy array is different and efficient than the Python list.<\/p>\n<h4 id=\"Indexing-Slicing-Numpy-Array\">Indexing and Slicing in Numpy Array<\/h4>\n<p><strong>Indexing<\/strong> is used for finding the element at a particular position in the number list.<\/p>\n<p><strong>Slicing<\/strong> is finding a set of elements from its starting to end point.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\narr=[[0,1,2,3,4],[10,11,12,13,14],[20,21,22,23,24]]\r\nintArr=np.array(arr)\r\nprint(intArr[1,3]) #indexing\r\nprint(intArr[1:2,1:3]) #slicing<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>13\r\n\r\n[[11 12]]<\/pre>\n<h4 id=\"Reshape-Numpy-Array\">Reshaping Numpy Array<\/h4>\n<p>You can change the dimension of the Numpy array.<\/p>\n<p><strong>Program to Change the Dimension of the Numpy Array from (3,5) to (5,5):<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\narr=np.array([[0,1,2,3,4],[10,11,12,13,14],[20,21,22,23,24]])\r\nprint(arr.shape)\r\nprint(arr.reshape(5,3))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>(3, 5)\r\n[[ 0 1 2]\r\n[ 3 4 10]\r\n[11 12 13]\r\n[14 20 21]\r\n[22 23 24]]<\/pre>\n<p>Note: You can not simply change the array with any dimensions. Dimension should be matching to the dimension of the initial array.<\/p>\n<h4 id=\"Auto-Initialized-Numpy-Arrays\">Creating Auto Initialized Numpy Arrays<\/h4>\n<p><strong>Program to create Numpy array having numbers from 0 to 9.<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\niniArr = np.arange(10)\r\nprint(iniArr)\r\n\r\n#creating multidimentional initialized array\r\niniArr2 = np.array([np.arange(10),np.arange(10)])\r\nprint(iniArr2)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[0 1 2 3 4 5 6 7 8 9]\r\n\r\n[[0 1 2 3 4 5 6 7 8 9]\r\n[0 1 2 3 4 5 6 7 8 9]]<\/pre>\n<p>We can auto initialize both single and multi-dimensional Numpy array.<\/p>\n<p><strong>Initializing Numpy array with ones.<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\niniArr = np.ones(10)\r\nprint(iniArr)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]<\/pre>\n<p>Here, by default, the type of Numpy array is a float.<\/p>\n<p><strong>Arranging Numpy Array with Power on n-value.<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\niniArr = np.arange(10)**2\r\nprint(iniArr)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[ 0 1 4 9 16 25 36 49 64 81]<\/pre>\n<h3 id=\"Numpy-Mathematical-Operations-on-Matrix\" style=\"text-align: center;\">Mathematical Operations on Numpy Matrix<\/h3>\n<p>Numpy Python module has special functions for matrix operations. It is very useful in data science for processing data.<\/p>\n<p>If you are familiar with the matrix, you might aware how complicate matrix operations are. If you are using Numpy array for matrix operation, you don&#8217;t need to write logic for matrix operations.<\/p>\n<p>Just think what you need to do with the matrix and Numpy will do for you.<\/p>\n<p>It makes your job pretty easy now, doesn&#8217;t it?<\/p>\n<h4 id=\"Creating-Identity-Matrix-Array-Numpy\">Creating Identity Matrix Array in Numpy<\/h4>\n<p><strong>What is an Identity Matrix?<\/strong><\/p>\n<p>If the transpose of the matrix is one, it is called as an identity matrix.<\/p>\n<p><strong>Characteristics of Identity Matrix:<\/strong><\/p>\n<ul>\n<li>If we mark all the diagonal elements one and all other zeros, it becomes identity matrix.<\/li>\n<li>Multiplying the identity matrix to any other matrix will give the same matrix.<\/li>\n<\/ul>\n<p>Numpy has a built-in function to create an identity matrix.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre>identity(size)<\/pre>\n<p><strong>Program:<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\nprint(np.identity(10))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\r\n[0. 1. 0. 0. 0. 0. 0. 0. 0. 0.]\r\n[0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]\r\n[0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]\r\n[0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]\r\n[0. 0. 0. 0. 0. 1. 0. 0. 0. 0.]\r\n[0. 0. 0. 0. 0. 0. 1. 0. 0. 0.]\r\n[0. 0. 0. 0. 0. 0. 0. 1. 0. 0.]\r\n[0. 0. 0. 0. 0. 0. 0. 0. 1. 0.]\r\n[0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]]<\/pre>\n<h4 id=\"Scalar-Matrix-Multiplication\">Scalar Matrix multiplication in Numpy<\/h4>\n<p>In scalar multiplication, each element in the matrix is multiplied by the constant number value.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\nxArr = np.arange(10)\r\nyArr = np.array([xArr,xArr])\r\n#Scalar multiplication\r\nprint(yArr*2)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18],\r\n[ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18]]<\/pre>\n<h4 id=\"Dot-Matrix-Multiplication\">Dot Matrix Multiplication in Numpy<\/h4>\n<p>In Dot multiplication, two matrices are multiplied.<\/p>\n<pre>A(x,y) * B(y,z) = C (x,z)<\/pre>\n<p><strong>Note:<\/strong> For dot matrix multiplication, number of column in the first matrix should be the same as the number of rows in the second matrix<\/p>\n<p>As like scalar matrix multiplication, dot matrix multiplication in Numpy has special function dot().<\/p>\n<p><strong>Program for Dot Matrix:<\/strong><\/p>\n<pre class=\"brush: python\">import numpy as np\r\nnewArr = np.dot(yArr,yArr.reshape(10,2)) #Dot product\r\nprint(newArr)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[220 265]\r\n[220 265]]<\/pre>\n<h4 id=\"Initialize-Numpy-Array-with-Random-Numbers\">Initialize Numpy Array with Random Numbers<\/h4>\n<p>Numpy supports random number to initialize\u00a0the array. You can also provide the range of values for the random number.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\nnp.random.randint(-10,10,size=(9,9))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>[[ 5, 5, -5, 4, -10, -8, 7, 9, 8],\r\n[ 0, -4, -8, -1, -1, -8, 6, 9, -7],\r\n[ 7, -5, 2, 0, 7, -8, 6, -3, -4],\r\n[ 5, 3, 0, 4, 4, 3, 0, -5, 0],\r\n[ -5, 4, -2, 3, 2, 6, -4, -1, 6],\r\n[ -4, -10, -10, 0, -6, -2, -9, 4, 3],\r\n[ -4, 8, 8, -8, 8, -2, -8, 4, 4],\r\n[ -4, -9, -4, -4, 1, 9, -1, 9, 7],\r\n[ -2, -9, -4, -2, -6, 7, -5, 8, 7]]<\/pre>\n<h4 id=\"Explore-Numpy\" style=\"text-align: center;\">Your Action&#8230;<\/h4>\n<p style=\"text-align: left;\">This is all about Numpy tutorial for data science. I have tried to explain it with required programming examples.<\/p>\n<p>There are many functions you can use with Numpy array for data analytics.<\/p>\n<p>Here is the simple program to list all the Python functions associated with Numpy array.<\/p>\n<pre class=\"brush: python\">import numpy as np\r\narr = np.array([23, 45, 24, 55])\r\nprint(dir(arr))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre>['T', '__abs__', '__add__', '__and__', '__array__', '__array_finalize__', '__array_interface__', '__array_prepare__', '__array_priority__', '__array_struct__', '__array_ufunc__', '__array_wrap__', '__bool__', '__class__', '__complex__', '__contains__', '__copy__', '__deepcopy__', '__delattr__', '__delitem__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__', '__imul__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__ior__', '__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__', '__le__', '__len__', '__lshift__', '__lt__', '__matmul__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__xor__', 'all', 'any', 'argmax', 'argmin', 'argpartition', 'argsort', 'astype', 'base', 'byteswap', 'choose', 'clip', 'compress', 'conj', 'conjugate', 'copy', 'ctypes', 'cumprod', 'cumsum', 'data', 'diagonal', 'dot', 'dtype', 'dump', 'dumps', 'fill', 'flags', 'flat', 'flatten', 'getfield', 'imag', 'item', 'itemset', 'itemsize', 'max', 'mean', 'min', 'nbytes', 'ndim', 'newbyteorder', 'nonzero', 'partition', 'prod', 'ptp', 'put', 'ravel', 'real', 'repeat', 'reshape', 'resize', 'round', 'searchsorted', 'setfield', 'setflags', 'shape', 'size', 'sort', 'squeeze', 'std', 'strides', 'sum', 'swapaxes', 'take', 'tobytes', 'tofile', 'tolist', 'tostring', 'trace', 'transpose', 'var', 'view']<\/pre>\n<p>Try to implement these Numpy functions in your actual data science project.<\/p>\n<p>As like Numpy, there are some <a href=\"https:\/\/www.csestack.org\/python-libraries-for-data-science\/\">more\u00a0essential Python libraries for Data Science<\/a>. Explore these libraries to excel in Data Science.<\/p>\n<p>In the next tutorial, we will explore one more Data Science library called Pandas. You can always check all the updated post on my <a href=\"https:\/\/www.csestack.org\/python\">complete Python tutorial page<\/a>. Stay Tuned!<\/p>\n<p>If you like this Numpy data analytics tutorial and find it informative, please do share with your friends.<\/p>\n<p style=\"text-align: center;\">Happy Pythoning!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.<\/p>\n","protected":false},"author":1,"featured_media":2912,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,73],"tags":[125,266,202,265],"class_list":["post-3971","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","category-python","tag-data-analytics","tag-data-science","tag-data-scientist","tag-numpy"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Best Numpy Data Analytics Tutorial | Array Operations Explained with Code<\/title>\n<meta name=\"description\" content=\"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.\" \/>\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.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code\" \/>\n<meta property=\"og:description\" content=\"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/\" \/>\n<meta property=\"og:site_name\" content=\"CSEstack\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/aniruddha.ca\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/aniruddha.ca\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-22T11:42:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-25T03:26:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"482\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Aniruddha Chaudhari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ani_chaudhari\" \/>\n<meta name=\"twitter:site\" content=\"@ani_chaudhari\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Aniruddha Chaudhari\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/\"},\"author\":{\"name\":\"Aniruddha Chaudhari\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#\\\/schema\\\/person\\\/634ef1a9c4f38b0d340c6d45fa771218\"},\"headline\":\"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code\",\"datePublished\":\"2018-08-22T11:42:09+00:00\",\"dateModified\":\"2019-10-25T03:26:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/\"},\"wordCount\":1266,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#\\\/schema\\\/person\\\/634ef1a9c4f38b0d340c6d45fa771218\"},\"image\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/Python-for-data-science.jpg\",\"keywords\":[\"data analytics\",\"data science\",\"data scientist\",\"numpy\"],\"articleSection\":[\"Code\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/\",\"url\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/\",\"name\":\"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/Python-for-data-science.jpg\",\"datePublished\":\"2018-08-22T11:42:09+00:00\",\"dateModified\":\"2019-10-25T03:26:49+00:00\",\"description\":\"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/Python-for-data-science.jpg\",\"contentUrl\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/Python-for-data-science.jpg\",\"width\":640,\"height\":482,\"caption\":\"Python for data science\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/python-numpy-data-analytics-tutorial-array-operations-code\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.csestack.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#website\",\"url\":\"https:\\\/\\\/www.csestack.org\\\/\",\"name\":\"CSEstack\",\"description\":\"Computer Science &amp; Programming Portal\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#\\\/schema\\\/person\\\/634ef1a9c4f38b0d340c6d45fa771218\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.csestack.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.csestack.org\\\/#\\\/schema\\\/person\\\/634ef1a9c4f38b0d340c6d45fa771218\",\"name\":\"Aniruddha Chaudhari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/Aniruddha-Chaudhari.jpg\",\"url\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/Aniruddha-Chaudhari.jpg\",\"contentUrl\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/Aniruddha-Chaudhari.jpg\",\"width\":634,\"height\":634,\"caption\":\"Aniruddha Chaudhari\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.csestack.org\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/Aniruddha-Chaudhari.jpg\"},\"description\":\"I am a Python enthusiast who loves Linux and Vim. I hold a Master of Computer Science degree from NIT Trichy and have 10 years of experience in the IT industry, focusing on the Software Development Lifecycle from Requirements Gathering, Design, Development to Deployment. I have worked at IBM, Ericsson, and NetApp, and I share my knowledge on CSEstack.org.\",\"sameAs\":[\"https:\\\/\\\/www.csestack.org\",\"https:\\\/\\\/www.facebook.com\\\/aniruddha.ca\",\"pythonwithani\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/aniruddha28\\\/\",\"https:\\\/\\\/x.com\\\/ani_chaudhari\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCw0a__B0eJsvCujkSIfLTAA\"],\"url\":\"https:\\\/\\\/www.csestack.org\\\/author\\\/anicse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code","description":"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.","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.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/","og_locale":"en_US","og_type":"article","og_title":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code","og_description":"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.","og_url":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/","og_site_name":"CSEstack","article_publisher":"https:\/\/www.facebook.com\/aniruddha.ca","article_author":"https:\/\/www.facebook.com\/aniruddha.ca","article_published_time":"2018-08-22T11:42:09+00:00","article_modified_time":"2019-10-25T03:26:49+00:00","og_image":[{"width":640,"height":482,"url":"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg","type":"image\/jpeg"}],"author":"Aniruddha Chaudhari","twitter_card":"summary_large_image","twitter_creator":"@ani_chaudhari","twitter_site":"@ani_chaudhari","twitter_misc":{"Written by":"Aniruddha Chaudhari","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#article","isPartOf":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/"},"author":{"name":"Aniruddha Chaudhari","@id":"https:\/\/www.csestack.org\/#\/schema\/person\/634ef1a9c4f38b0d340c6d45fa771218"},"headline":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code","datePublished":"2018-08-22T11:42:09+00:00","dateModified":"2019-10-25T03:26:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/"},"wordCount":1266,"commentCount":0,"publisher":{"@id":"https:\/\/www.csestack.org\/#\/schema\/person\/634ef1a9c4f38b0d340c6d45fa771218"},"image":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg","keywords":["data analytics","data science","data scientist","numpy"],"articleSection":["Code","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/","url":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/","name":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code","isPartOf":{"@id":"https:\/\/www.csestack.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#primaryimage"},"image":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg","datePublished":"2018-08-22T11:42:09+00:00","dateModified":"2019-10-25T03:26:49+00:00","description":"Python Numpy data analytics tutorial for data science. Numpy multidimensional array operations explained with programming and examples.","breadcrumb":{"@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#primaryimage","url":"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg","contentUrl":"https:\/\/www.csestack.org\/wp-content\/uploads\/2017\/10\/Python-for-data-science.jpg","width":640,"height":482,"caption":"Python for data science"},{"@type":"BreadcrumbList","@id":"https:\/\/www.csestack.org\/python-numpy-data-analytics-tutorial-array-operations-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.csestack.org\/"},{"@type":"ListItem","position":2,"name":"Best Numpy Data Analytics Tutorial | Array Operations Explained with Code"}]},{"@type":"WebSite","@id":"https:\/\/www.csestack.org\/#website","url":"https:\/\/www.csestack.org\/","name":"CSEstack","description":"Computer Science &amp; Programming Portal","publisher":{"@id":"https:\/\/www.csestack.org\/#\/schema\/person\/634ef1a9c4f38b0d340c6d45fa771218"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.csestack.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.csestack.org\/#\/schema\/person\/634ef1a9c4f38b0d340c6d45fa771218","name":"Aniruddha Chaudhari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.csestack.org\/wp-content\/uploads\/2019\/03\/Aniruddha-Chaudhari.jpg","url":"https:\/\/www.csestack.org\/wp-content\/uploads\/2019\/03\/Aniruddha-Chaudhari.jpg","contentUrl":"https:\/\/www.csestack.org\/wp-content\/uploads\/2019\/03\/Aniruddha-Chaudhari.jpg","width":634,"height":634,"caption":"Aniruddha Chaudhari"},"logo":{"@id":"https:\/\/www.csestack.org\/wp-content\/uploads\/2019\/03\/Aniruddha-Chaudhari.jpg"},"description":"I am a Python enthusiast who loves Linux and Vim. I hold a Master of Computer Science degree from NIT Trichy and have 10 years of experience in the IT industry, focusing on the Software Development Lifecycle from Requirements Gathering, Design, Development to Deployment. I have worked at IBM, Ericsson, and NetApp, and I share my knowledge on CSEstack.org.","sameAs":["https:\/\/www.csestack.org","https:\/\/www.facebook.com\/aniruddha.ca","pythonwithani","https:\/\/www.linkedin.com\/in\/aniruddha28\/","https:\/\/x.com\/ani_chaudhari","https:\/\/www.youtube.com\/channel\/UCw0a__B0eJsvCujkSIfLTAA"],"url":"https:\/\/www.csestack.org\/author\/anicse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/posts\/3971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/comments?post=3971"}],"version-history":[{"count":24,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/posts\/3971\/revisions"}],"predecessor-version":[{"id":6112,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/posts\/3971\/revisions\/6112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/media\/2912"}],"wp:attachment":[{"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/media?parent=3971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/categories?post=3971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.csestack.org\/wp-json\/wp\/v2\/tags?post=3971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}