{"id":128,"date":"2026-03-02T14:16:32","date_gmt":"2026-03-02T09:16:32","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=128"},"modified":"2026-03-16T18:21:25","modified_gmt":"2026-03-16T13:21:25","slug":"introduction-to-numpy","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/","title":{"rendered":"Introduction to NumPy"},"content":{"rendered":"\n<p>NumPy is a powerful Python library used for numerical computing. It stands for <strong>Numerical Python<\/strong> and is widely used in Data Analytics, Data Science, Machine Learning, and scientific computing.<\/p>\n\n\n\n<p>NumPy provides fast and efficient operations on large datasets using arrays.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use NumPy?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster than Python lists<\/li>\n\n\n\n<li>Supports large multi-dimensional arrays<\/li>\n\n\n\n<li>Provides mathematical and statistical functions<\/li>\n\n\n\n<li>Used as a foundation for libraries like pandas and matplotlib<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installing NumPy<\/h2>\n\n\n\n<p>If not installed, use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install numpy<\/pre>\n\n\n\n<p>Import NumPy in Python:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import numpy as np<\/pre>\n\n\n\n<p><code>np<\/code> is the common alias used for NumPy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a NumPy Array?<\/h2>\n\n\n\n<p>A NumPy array is a grid of values stored in rows and columns.<\/p>\n\n\n\n<p>Example of creating an array:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import numpy as nparr = np.array([1, 2, 3, 4, 5])<br>print(arr)<\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[1 2 3 4 5]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Different Types of Arrays<\/h2>\n\n\n\n<p>Create a 2D array:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr = np.array([[1, 2, 3], [4, 5, 6]])<\/pre>\n\n\n\n<p>Create an array of zeros:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.zeros((3, 3))<\/pre>\n\n\n\n<p>Create an array of ones:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.ones((2, 4))<\/pre>\n\n\n\n<p>Create a range of numbers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.arange(0, 10)<\/pre>\n\n\n\n<p>Create evenly spaced numbers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.linspace(0, 1, 5)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Array Attributes<\/h2>\n\n\n\n<p>Check shape (rows, columns):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr.shape<\/pre>\n\n\n\n<p>Check number of dimensions:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr.ndim<\/pre>\n\n\n\n<p>Check data type:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr.dtype<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Mathematical Operations<\/h2>\n\n\n\n<p>Addition:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr + 2<\/pre>\n\n\n\n<p>Multiplication:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr * 3<\/pre>\n\n\n\n<p>Square:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">arr ** 2<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Statistical Functions<\/h2>\n\n\n\n<p>Mean:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.mean(arr)<\/pre>\n\n\n\n<p>Sum:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.sum(arr)<\/pre>\n\n\n\n<p>Minimum value:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.min(arr)<\/pre>\n\n\n\n<p>Maximum value:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.max(arr)<\/pre>\n\n\n\n<p>Standard deviation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">np.std(arr)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Why NumPy is Important in Analytics<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handles large datasets efficiently<\/li>\n\n\n\n<li>Performs fast mathematical calculations<\/li>\n\n\n\n<li>Supports matrix operations<\/li>\n\n\n\n<li>Forms the base of pandas and many ML libraries<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Key Takeaway<\/h2>\n\n\n\n<p>NumPy is the foundation of numerical computing in Python. If you want to work in Data Analytics or Data Science, mastering NumPy is essential for handling arrays and performing fast mathematical operations.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773667270778\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FOR DATA ANALYTICS (PYDA) > NumPy > Introduction to NumPy<\/span><\/span><\/div>","protected":false},"menu_order":65,"template":"","class_list":["post-128","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Introduction to NumPy - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to NumPy - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-16T13:21:25+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/introduction-to-numpy\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/introduction-to-numpy\\\/\",\"name\":\"Introduction to NumPy - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-02T09:16:32+00:00\",\"dateModified\":\"2026-03-16T13:21:25+00:00\",\"description\":\"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/introduction-to-numpy\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/introduction-to-numpy\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/introduction-to-numpy\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FOR DATA ANALYTICS (PYDA) > NumPy > Introduction to NumPy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Introduction to NumPy - One Language. Endless Possibilities","description":"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.","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:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to NumPy - One Language. Endless Possibilities","og_description":"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.","og_url":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-16T13:21:25+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/","url":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/","name":"Introduction to NumPy - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-02T09:16:32+00:00","dateModified":"2026-03-16T13:21:25+00:00","description":"Master Python NumPy for numerical computing, arrays, and fast data analysis. Essential for Data Analytics, Data Science, and ML.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/introduction-to-numpy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FOR DATA ANALYTICS (PYDA) > NumPy > Introduction to NumPy"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}