{"id":136,"date":"2026-03-02T15:14:52","date_gmt":"2026-03-02T10:14:52","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=136"},"modified":"2026-03-17T07:55:09","modified_gmt":"2026-03-17T02:55:09","slug":"series-and-dataframe","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/","title":{"rendered":"Series and DataFrame"},"content":{"rendered":"\n<p>In Pandas, <strong>Series<\/strong> and <strong>DataFrame<\/strong> are the two main data structures used for handling data.<\/p>\n\n\n\n<p>They help you organize, analyze, and manipulate structured datasets efficiently.<\/p>\n\n\n\n<p>First, import pandas:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pandas as pd<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">1. Series<\/h2>\n\n\n\n<p>A Series is a one-dimensional labeled array.<br>It is similar to a single column in a table.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a Series<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">data = pd.Series([10, 20, 30, 40])<br>print(data)<\/pre>\n\n\n\n<p>By default, pandas assigns index values starting from 0.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a Series with Custom Index<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">data = pd.Series([10, 20, 30], index=[\"A\", \"B\", \"C\"])<br>print(data)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Accessing Values<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">data[\"A\"]<br>data[0]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Series from Dictionary<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">data = pd.Series({<br>    \"Ali\": 85,<br>    \"Sara\": 90,<br>    \"Ahmed\": 78<br>})<br>print(data)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. DataFrame<\/h2>\n\n\n\n<p>A DataFrame is a two-dimensional data structure.<br>It is like a table with rows and columns.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a DataFrame<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">data = {<br>    \"Name\": [\"Ali\", \"Sara\", \"Ahmed\"],<br>    \"Age\": [25, 28, 30],<br>    \"Salary\": [50000, 60000, 70000]<br>}df = pd.DataFrame(data)<br>print(df)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Viewing DataFrame Information<\/h3>\n\n\n\n<p>First 5 rows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df.head()<\/pre>\n\n\n\n<p>Basic information:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df.info()<\/pre>\n\n\n\n<p>Statistical summary:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df.describe()<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Selecting Data in DataFrame<\/h2>\n\n\n\n<p>Select a single column:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df[\"Name\"]<\/pre>\n\n\n\n<p>Select multiple columns:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df[[\"Name\", \"Salary\"]]<\/pre>\n\n\n\n<p>Select rows by index:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df.loc[0]<\/pre>\n\n\n\n<p>Filter data using condition:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df[df[\"Age\"] &gt; 26]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Key Differences Between Series and DataFrame<\/h2>\n\n\n\n<p>Series:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One-dimensional<\/li>\n\n\n\n<li>Represents a single column<\/li>\n\n\n\n<li>Has index and values<\/li>\n<\/ul>\n\n\n\n<p>DataFrame:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Two-dimensional<\/li>\n\n\n\n<li>Contains multiple columns<\/li>\n\n\n\n<li>Each column is a Series<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Why Series and DataFrame Matter<\/h2>\n\n\n\n<p>These structures allow you to:<\/p>\n\n\n\n<p>Store structured data<br>Analyze real-world datasets<br>Perform filtering and grouping<br>Handle missing values<br>Prepare data for visualization and machine learning<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Key Takeaway<\/h2>\n\n\n\n<p>Series and DataFrame are the foundation of data analysis in Pandas.<br>Understanding these two structures is essential for working with real-world datasets efficiently.<\/p>\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) > Pandas > Series and DataFrame<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773716217156\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":71,"template":"","class_list":["post-136","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>Series and DataFrame - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.\" \/>\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\/series-and-dataframe\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Series and DataFrame - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-17T02:55:09+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\\\/series-and-dataframe\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/series-and-dataframe\\\/\",\"name\":\"Series and DataFrame - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-02T10:14:52+00:00\",\"dateModified\":\"2026-03-17T02:55:09+00:00\",\"description\":\"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/series-and-dataframe\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/series-and-dataframe\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/series-and-dataframe\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FOR DATA ANALYTICS (PYDA) > Pandas > Series and DataFrame\"}]},{\"@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":"Series and DataFrame - One Language. Endless Possibilities","description":"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.","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\/series-and-dataframe\/","og_locale":"en_US","og_type":"article","og_title":"Series and DataFrame - One Language. Endless Possibilities","og_description":"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.","og_url":"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-17T02:55:09+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\/series-and-dataframe\/","url":"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/","name":"Series and DataFrame - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-02T10:14:52+00:00","dateModified":"2026-03-17T02:55:09+00:00","description":"Learn Pandas Series and DataFrame in Python. Create, view, and filter structured data to perform efficient data analysis.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/series-and-dataframe\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FOR DATA ANALYTICS (PYDA) > Pandas > Series and DataFrame"}]},{"@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\/136","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=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}