{"id":2059,"date":"2026-07-22T06:00:16","date_gmt":"2026-07-21T23:00:16","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-use-pandas-for-data-manipulation-a-practical-tutorial\/"},"modified":"2026-07-22T06:00:17","modified_gmt":"2026-07-21T23:00:17","slug":"how-to-use-pandas-for-data-manipulation-a-practical-tutorial","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-use-pandas-for-data-manipulation-a-practical-tutorial\/","title":{"rendered":"How to Use Pandas for Data Manipulation: A Practical Tutorial"},"content":{"rendered":"<h1>How to Use Pandas for Data Manipulation: A Practical Tutorial<\/h1>\n<p>Pandas is a powerful Python library for data manipulation and analysis. Whether you&#8217;re cleaning messy datasets, transforming columns, or performing group operations, Pandas provides intuitive tools that make these tasks efficient. This tutorial covers the essential operations you need to get started with real-world data wrangling.<\/p>\n<h2>Loading and Inspecting Your Data<\/h2>\n<p>First, import Pandas and load a CSV file using <code>read_csv()<\/code>. Use <code>head()<\/code> to preview the first few rows and <code>info()<\/code> to understand column types and missing values.<\/p>\n<ul>\n<li><code>import pandas as pd<\/code><\/li>\n<li><code>df = pd.read_csv('data.csv')<\/code><\/li>\n<li><code>df.head()<\/code> \u2014 see first 5 rows<\/li>\n<li><code>df.info()<\/code> \u2014 check data types and nulls<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/sumberlaba.com\/wp-content\/uploads\/2026\/07\/article-1784674814468.jpg\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>Selecting and Filtering Rows or Columns<\/h2>\n<p>Use bracket notation or <code>loc<\/code> \/ <code>iloc<\/code> for precise selection. To filter rows by a condition, use boolean indexing.<\/p>\n<ul>\n<li>Select a column: <code>df['column_name']<\/code><\/li>\n<li>Select rows where value > 50: <code>df[df['column'] > 50]<\/code><\/li>\n<li>Select specific rows and columns with <code>loc<\/code>: <code>df.loc[0:5, ['col1','col2']]<\/code><\/li>\n<\/ul>\n<h2>Cleaning and Transforming Data<\/h2>\n<p>Handle missing values with <code>fillna()<\/code> or <code>dropna()<\/code>. Rename columns using <code>rename()<\/code> and apply functions across rows or columns with <code>apply()<\/code>.<\/p>\n<ul>\n<li><code>df.fillna(df.mean())<\/code> \u2014 fill NaN with column mean<\/li>\n<li><code>df.rename(columns={'old':'new'}, inplace=True)<\/code><\/li>\n<li><code>df['new_col'] = df['col'].apply(lambda x: x * 2)<\/code><\/li>\n<\/ul>\n<h2>Grouping and Aggregating Data<\/h2>\n<p>Group data by a categorical column and compute summary statistics using <code>groupby()<\/code> with <code>agg()<\/code>.<\/p>\n<ul>\n<li><code>df.groupby('category')['value'].mean()<\/code><\/li>\n<li>Multiple aggregations: <code>df.groupby('cat').agg(['sum','mean','count'])<\/code><\/li>\n<\/ul>\n<p>Mastering these core pandas operations will allow you to quickly clean, filter, and summarize any tabular dataset. Practice on real data to build confidence and speed up your data manipulation workflow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Use Pandas for Data Manipulation: A Practical Tutorial Pandas is a powerful Python library for data manipulation and analysis. Whether you&#8217;re cleaning messy datasets, transforming columns, or performing group operations, Pandas provides intuitive tools that make these tasks efficient. This tutorial covers the essential operations you need to get started with real-world data &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":2058,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-non-category"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=2059"}],"version-history":[{"count":1,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2059\/revisions"}],"predecessor-version":[{"id":2060,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2059\/revisions\/2060"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media\/2058"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=2059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=2059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=2059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}