*{box-sizing:border-box;margin:0;padding:0;}
body{font-family:’Segoe UI’,sans-serif;color:#1e293b;line-height:1.7;background:#f8fafc;}
.container{max-width:820px;margin:0 auto;padding:24px 16px;}
h1{font-size:2rem;font-weight:800;color:#0D1B2A;line-height:1.25;margin-bottom:18px;}
h2{font-size:1.45rem;font-weight:700;color:#1D4ED8;margin:36px 0 14px;}
h3{font-size:1.1rem;font-weight:700;color:#0D1B2A;margin:20px 0 8px;}
p{margin-bottom:14px;font-size:1rem;}
ul,ol{padding-left:22px;margin-bottom:16px;}
li{margin-bottom:8px;font-size:1rem;}
code{background:#f1f5f9;padding:2px 6px;border-radius:4px;font-family:’Consolas’,’Courier New’,monospace;font-size:0.92em;color:#7c3aed;}
pre{background:#1e293b;color:#e2e8f0;padding:16px 18px;border-radius:8px;overflow-x:auto;margin:14px 0 18px;font-size:0.88rem;line-height:1.6;}
pre code{background:none;color:inherit;padding:0;}
table{width:100%;border-collapse:collapse;margin:20px 0;font-size:0.93rem;}
th{background:#1D4ED8;color:#fff;padding:10px 12px;text-align:left;}
td{padding:9px 12px;border-bottom:1px solid #e2e8f0;}
tr:nth-child(even) td{background:#f1f5f9;}
.takeaway{background:#EEF2FF;border-left:4px solid #4F46E5;border-radius:0 8px 8px 0;padding:16px 20px;margin:18px 0;}
.takeaway strong{color:#4F46E5;display:block;margin-bottom:4px;}
.tl-dr{background:#f0fdf4;border:1px solid #86efac;border-radius:8px;padding:18px 22px;margin:20px 0;}
.tl-dr h3{color:#16a34a;margin-bottom:10px;}
.gai-table-wrap{overflow-x:auto;margin:20px 0;}
.gai-table-wrap table{margin:0;}
@media(max-width:600px){h1{font-size:1.5rem;}h2{font-size:1.2rem;}.gai-table-wrap{font-size:13px;}pre{font-size:0.8rem;padding:12px;}}
Data Cleaning with Python Pandas 2026: Complete Guide for Indian Data Analysts
Here is a number that should reframe how you think about data work: 80% of a data scientist’s time is spent on data cleaning. Not building models. Not creating dashboards. Not presenting insights. Cleaning. According to surveys by Anaconda and Kaggle, this ratio has held steady for years and shows no sign of changing in 2026. The reason is simple — real-world data is messy. Indian datasets are especially challenging: phone numbers with inconsistent +91 and 0 prefixes, city names that alternate between “Bangalore” and “Bengaluru” within the same column, dates stored as DD/MM/YYYY in one system and MM/DD/YYYY in another, and currency values formatted as ₹1,00,000 (Indian numbering) alongside 100000 (raw integer). If you want to work as a data analyst in India — where salaries range from ₹4 LPA for freshers to ₹12+ LPA for experienced professionals — data cleaning with Python Pandas is not an optional skill. It is the skill that determines whether your analysis produces reliable results or garbage.
Direct Answer: Data cleaning with Python Pandas in 2026 involves a systematic pipeline: load your data, inspect it using info(), describe(), and value_counts(), then clean it by handling missing values (dropna, fillna, interpolate), removing duplicates (drop_duplicates), fixing data types (astype, to_datetime), standardising strings (str.strip, str.lower, str.replace), detecting outliers (IQR method, Z-score), and merging datasets (merge, concat, join). Each step has specific Pandas methods designed for it, and this guide covers every one with real Indian dataset examples, code you can run immediately in Jupyter Notebook or Google Colab, and the exact patterns interviewers test in data analyst hiring.
TL;DR — Data Cleaning with Python Pandas 2026
- 80% rule: Four-fifths of data work is cleaning. Mastering Pandas cleaning methods is the highest-leverage skill for Indian data analysts.
- 5-step pipeline: Load → Inspect (
info,describe,value_counts) → Clean (missing values, duplicates, types, strings, outliers) → Validate → Export. - Missing values:
dropna()to remove,fillna()to replace,interpolate()for time-series. Choose based on the percentage missing and data type. - Indian data quirks: Phone numbers (+91/0 prefix), city names (Bangalore/Bengaluru), dates (DD/MM vs MM/DD), currency (₹1,00,000 vs 100000) — all require specific regex and mapping fixes.
- Outlier detection: IQR method for skewed data, Z-score for normally distributed data. Never delete outliers blindly — investigate first.
- Interview critical: Data cleaning questions appear in 70%+ of data analyst interviews.
drop_duplicates,fillna,astype, andmergeare the most tested methods. - Tools: Jupyter Notebook (local), Google Colab (free, cloud-based, GPU access). Both support Pandas natively.
- Salary context: Data analysts in India earn ₹4-12 LPA. Cleaning skills differentiate candidates who get hired from those who stay in the applicant pool.
Why Data Cleaning Is the Core Skill of Data Analytics
Every dataset you encounter in a real Indian company — whether it is an export from a CRM like Zoho or Vtiger, a dump from a MySQL database, a CSV from a government portal, or an API response from a payment gateway like Razorpay — will have quality issues. Missing fields where users skipped form inputs. Duplicate rows from system retries or manual data entry. Columns stored as strings that should be numbers. Dates in three different formats because three different teams entered data. Phone numbers with country codes, without country codes, with leading zeros, without leading zeros. Names in ALL CAPS, Title Case, and lowercase within the same column.
If you build a chart, a report, or a machine learning model on top of this data without cleaning it first, your output will be wrong. Not slightly wrong — fundamentally wrong. A sales report that double-counts revenue because of duplicate entries. A customer segmentation that splits “Bangalore” and “Bengaluru” into two separate cities. A trend analysis that breaks because half the dates parsed as January when they were actually in DD/MM format. Data cleaning is not a preliminary chore. It is the foundation that determines whether everything built on top of it is trustworthy.
Python Pandas is the tool the industry has standardised on for this work. It is the most popular data manipulation library in Python, with over 40 million monthly downloads on PyPI. Every data analyst job description in India lists Pandas as a required skill. And within Pandas, the cleaning and transformation methods — not the plotting methods, not the statistical methods — are what you will use most heavily in your daily work.
Data cleaning is not 80% of data work because analysts are slow at it. It is 80% because real-world data has that many problems. A dataset from any Indian enterprise system — Tally, SAP, Zoho, custom ERPs — will have missing values, duplicates, type mismatches, inconsistent formatting, and outliers. Pandas provides a dedicated method for each of these problems. Learning the six core cleaning operations (missing values, duplicates, data types, string cleaning, outlier detection, merging) covers 95% of what you will encounter in production.
The 5-Step Data Cleaning Pipeline
Professional data analysts do not clean data randomly. They follow a structured pipeline that ensures nothing is missed and each step builds on the previous one. Here is the exact pipeline, with the Pandas methods for each stage.
Step 1: Load the Data
Use pd.read_csv(), pd.read_excel(), or pd.read_json() depending on your source format. For Indian datasets, always specify the encoding parameter — many government and enterprise CSVs use encoding='latin-1' or encoding='cp1252' instead of UTF-8. Failing to set the correct encoding produces garbled Hindi or regional language characters.
import pandas as pd
# Load CSV with Indian encoding
df = pd.read_csv('sales_data.csv', encoding='utf-8')
# Load Excel (common in Indian enterprises)
df = pd.read_excel('crm_export.xlsx', sheet_name='Leads')
Step 2: Inspect the Data
Before cleaning anything, understand what you have. Three methods give you a complete picture:
# Column names, data types, non-null counts
df.info()
# Statistical summary for numeric columns
df.describe()
# Unique value distribution for a specific column
df['city'].value_counts()
# Check missing values per column
df.isnull().sum()
# Check duplicate rows
df.duplicated().sum()
df.info() tells you the data type of each column and how many non-null values exist — this immediately reveals columns with missing data and columns stored as the wrong type (a “price” column stored as object instead of float64). df.describe() shows min, max, mean, and quartiles for numeric columns — outliers become visible when the max is 100x the mean. value_counts() reveals inconsistent categorical values — you will see “Bangalore,” “Bengaluru,” “bangalore,” and “BANGALORE” as four separate entries.
Step 3: Clean the Data
This is the core step. It covers six operations, each explained in detail below.
Step 4: Validate the Results
After cleaning, re-run your inspection methods. df.info() should show correct data types and zero (or expected) null values. df.describe() should show reasonable ranges without extreme outliers. value_counts() on cleaned categorical columns should show consistent, standardised values. If validation reveals issues, return to Step 3.
# Post-cleaning validation
assert df.duplicated().sum() == 0, "Duplicates still exist"
assert df['phone'].isnull().sum() == 0, "Phone has missing values"
assert df['amount'].dtype == 'float64', "Amount is wrong type"
print("All validations passed.")
Step 5: Export the Clean Data
# Export cleaned data
df.to_csv('sales_data_cleaned.csv', index=False, encoding='utf-8')
# Or to Excel
df.to_excel('sales_data_cleaned.xlsx', index=False)
The 6 Core Cleaning Operations in Pandas
1. Handling Missing Values
Missing values appear as NaN (Not a Number) in Pandas. They are the most common data quality issue. Pandas gives you three strategies:
# Strategy 1: Remove rows with any missing values
df_clean = df.dropna()
# Strategy 2: Remove rows missing values in specific columns only
df_clean = df.dropna(subset=['email', 'phone'])
# Strategy 3: Fill missing values with a constant
df['city'].fillna('Unknown', inplace=True)
# Strategy 4: Fill with column mean (numeric columns)
df['salary'].fillna(df['salary'].mean(), inplace=True)
# Strategy 5: Fill with median (better for skewed data)
df['salary'].fillna(df['salary'].median(), inplace=True)
# Strategy 6: Forward-fill for time-series data
df['temperature'].fillna(method='ffill', inplace=True)
# Strategy 7: Interpolate (linear estimation)
df['stock_price'].interpolate(method='linear', inplace=True)
The decision rule: if less than 5% of rows are missing a value, dropna() is safe. If 5-30% are missing, use fillna() with mean, median, or mode depending on the distribution. If more than 30% of a column is missing, consider dropping the entire column — it is unlikely to be reliable enough for analysis. For time-series data (stock prices, temperatures, sensor readings), interpolate() produces more accurate fills than fillna() because it estimates values based on surrounding data points.
2. Removing Duplicates
# Remove exact duplicate rows
df = df.drop_duplicates()
# Remove duplicates based on specific columns
df = df.drop_duplicates(subset=['email'], keep='last')
# Keep first occurrence, remove subsequent duplicates
df = df.drop_duplicates(subset=['phone', 'order_id'], keep='first')
In Indian CRM and e-commerce datasets, duplicates commonly arise from system retries (a payment gateway timeout that creates two entries), manual data entry (an executive entering the same lead twice), and data imports (merging data from two systems without deduplication). Always specify which columns define uniqueness — two rows with different order IDs are not duplicates even if the customer name and amount match.
3. Fixing Data Types
# Convert string to numeric
df['revenue'] = pd.to_numeric(df['revenue'], errors='coerce')
# Convert to datetime
df['order_date'] = pd.to_datetime(df['order_date'], format='%d/%m/%Y')
# Convert to category (saves memory for large datasets)
df['state'] = df['state'].astype('category')
# Convert boolean stored as string
df['is_active'] = df['is_active'].map({'Yes': True, 'No': False})
The errors='coerce' parameter in pd.to_numeric() is critical for Indian datasets. When a “revenue” column contains entries like “₹1,50,000” or “N/A” or “-“, coerce converts these unparseable values to NaN instead of throwing an error, allowing you to handle them in the missing values step. For dates, always specify the format parameter explicitly — if you let Pandas guess, it will interpret “01/02/2026” as January 2 (American format) when it was actually February 1 (Indian format).
4. String Cleaning
# Remove leading/trailing whitespace
df['name'] = df['name'].str.strip()
# Convert to lowercase for consistency
df['email'] = df['email'].str.lower()
# Standardise city names
city_map = {
'bangalore': 'Bengaluru',
'bombay': 'Mumbai',
'madras': 'Chennai',
'calcutta': 'Kolkata'
}
df['city'] = df['city'].str.strip().str.lower().replace(city_map)
# Clean Indian phone numbers
df['phone'] = df['phone'].str.replace(r'[^0-9]', '', regex=True)
df['phone'] = df['phone'].str.replace(r'^91', '', regex=True)
df['phone'] = df['phone'].str.replace(r'^0', '', regex=True)
# Clean currency strings to numeric
df['amount'] = df['amount'].str.replace('₹', '').str.replace(',', '')
df['amount'] = pd.to_numeric(df['amount'], errors='coerce')
Indian phone numbers are notoriously inconsistent in datasets: +91-9876543210, 09876543210, 919876543210, 9876543210, +91 98765 43210. The three-step regex approach above strips all non-digit characters, removes the 91 country code prefix, and removes the leading 0 trunk prefix, leaving a clean 10-digit number. Similarly, Indian currency formatting uses the lakh-crore system (₹1,00,000 instead of ₹100,000), which breaks standard parsers. Stripping the rupee symbol and commas before converting to numeric handles both Indian and international formats.
5. Outlier Detection
# Method 1: IQR (Interquartile Range) -- best for skewed data
Q1 = df['salary'].quantile(0.25)
Q3 = df['salary'].quantile(0.75)
IQR = Q3 - Q1
lower_bound = Q1 - 1.5 * IQR
upper_bound = Q3 + 1.5 * IQR
outliers = df[(df['salary'] upper_bound)]
print(f"Found {len(outliers)} outliers")
# Method 2: Z-score -- best for normally distributed data
from scipy import stats
df['z_score'] = stats.zscore(df['salary'])
outliers = df[df['z_score'].abs() > 3]
# Cap outliers instead of removing (winsorisation)
df['salary'] = df['salary'].clip(lower=lower_bound, upper=upper_bound)
A critical rule: never delete outliers automatically. A salary of ₹50,00,000 in a dataset of junior analysts is likely a data entry error (someone entered annual salary in the monthly field). But a salary of ₹50,00,000 in a dataset of tech directors is a legitimate value. Always investigate outliers before deciding to remove, cap, or keep them. The IQR method works better for Indian salary data because salaries are typically right-skewed (many values at the lower end, fewer at the top). Z-score assumes normal distribution and can be misleading for skewed data.
6. Merging Datasets
# Inner join: only matching rows
merged = pd.merge(orders, customers, on='customer_id', how='inner')
# Left join: all rows from left, matching from right
merged = pd.merge(orders, customers, on='customer_id', how='left')
# Concatenate vertically (stacking DataFrames)
combined = pd.concat([df_jan, df_feb, df_mar], ignore_index=True)
# Join on index
merged = df1.join(df2, how='outer')
In Indian enterprise environments, you frequently need to merge data from different systems: CRM leads with payment records, student enrollment data with assessment scores, HR records with attendance logs. The how parameter is critical — 'inner' drops unmatched rows (use when you only want complete records), 'left' keeps all rows from the primary dataset (use when you want to identify which records have no match in the secondary dataset), and 'outer' keeps everything (use for full reconciliation). Always check the row count before and after merging to catch unexpected duplicates from many-to-many relationships.
The six operations — missing values, duplicates, data types, string cleaning, outlier detection, and merging — cover 95% of data cleaning tasks in production. They are also the six topics that appear most frequently in data analyst interview coding rounds in India. Memorise the methods, but more importantly, understand when to apply each one:
dropna() when less than 5% is missing, fillna(median) for skewed numeric data, drop_duplicates(subset=...) with explicit uniqueness columns, to_datetime(format=...) with explicit format for Indian dates, regex-based str.replace for phone numbers and currency, and IQR for salary outlier detection.
Real-World Use Cases for Indian Data Analysts
Use Case 1: E-Commerce Sales Data
An Indian e-commerce company exports daily sales from its Shopify or WooCommerce store. Common issues: duplicate orders from payment retries, product names with inconsistent capitalisation, discount amounts stored as strings with “%” suffix, shipping addresses with city names in multiple formats (Mumbai/Bombay, 4-digit vs 6-digit pincodes). Cleaning pipeline: deduplicate on order_id, standardise city names using a mapping dictionary, strip “%” and convert discounts to float, validate pincodes against a reference list of Indian postal codes.
Use Case 2: Government Open Data (data.gov.in)
Indian government datasets from data.gov.in are notoriously messy: Hindi and English mixed in the same column, dates in DD-MM-YYYY format, numeric values stored with commas as thousand separators (Indian numbering: 1,00,000), missing values represented as “-“, “NA”, “N/A”, or empty strings instead of standard NaN. Cleaning pipeline: replace all missing value representations with np.nan, strip commas and convert numeric columns, parse dates with explicit dayfirst=True, separate or transliterate mixed-language columns.
Use Case 3: CRM Lead Data
CRM exports from Zoho, Vtiger, or Salesforce contain leads entered by multiple sales executives with no standardisation. The same company appears as “TCS,” “Tata Consultancy Services,” and “TATA CONSULTANCY” in the company name field. Phone numbers have every possible format. Email addresses have trailing spaces. Lead status values include “Hot,” “HOT,” “hot,” and “H.” Cleaning pipeline: lowercase and strip all string fields, deduplicate on phone number (after standardising to 10 digits), map status variants to a controlled vocabulary, validate email format with regex.
Use Case 4: HR and Payroll Data
Indian HR datasets contain salary components split across columns (basic, HRA, DA, special allowance) with amounts sometimes in monthly and sometimes in annual figures within the same dataset. Date of joining stored in multiple formats. Employee IDs with inconsistent prefixes (EMP001, EMP-001, 001). Cleaning pipeline: standardise all salary figures to monthly, parse dates with explicit format, strip prefixes and pad employee IDs to consistent length, validate that salary components sum to CTC within a tolerance of 1%.
Pandas Cleaning Methods: Quick Reference Table
| Problem | Pandas Method | When to Use | Example |
|---|---|---|---|
| Missing values (remove) | dropna() |
Less than 5% of rows affected | df.dropna(subset=['email']) |
| Missing values (fill) | fillna() |
5-30% missing; have a sensible default | df['city'].fillna('Unknown') |
| Missing values (estimate) | interpolate() |
Time-series or sequential data | df['price'].interpolate() |
| Duplicate rows | drop_duplicates() |
Exact or subset-based duplicates | df.drop_duplicates(subset=['email']) |
| Wrong numeric type | pd.to_numeric() |
Numbers stored as strings | pd.to_numeric(df['amt'], errors='coerce') |
| Wrong date type | pd.to_datetime() |
Dates stored as strings | pd.to_datetime(df['dt'], format='%d/%m/%Y') |
| Change column type | astype() |
Type conversion without parsing | df['id'].astype(str) |
| Leading/trailing spaces | str.strip() |
User-entered text data | df['name'].str.strip() |
| Inconsistent case | str.lower() |
Categorical text fields | df['city'].str.lower() |
| Pattern replacement | str.replace() |
Phone numbers, currency, special chars | df['phone'].str.replace(r'[^0-9]','',regex=True) |
| Outliers (skewed data) | IQR method | Salary, revenue, transaction amounts | Q1, Q3, IQR = quantile-based bounds |
| Outliers (normal data) | Z-score | Normally distributed metrics | stats.zscore(df['col']) |
| Combine datasets (keys) | pd.merge() |
Joining on shared columns | pd.merge(df1, df2, on='id', how='left') |
| Stack datasets (rows) | pd.concat() |
Appending similar DataFrames | pd.concat([jan, feb], ignore_index=True) |
Source: Pandas 2.x official documentation, Kaggle survey 2025, and GrowAI training curriculum.
Case Study: Cleaning a Real Indian Sales Dataset
Before
Arjun, a junior data analyst at a Hyderabad-based SaaS startup, received a CSV export of 18,000 sales records from the company’s CRM. The dataset had serious quality issues: 1,200 rows (6.7%) had missing phone numbers, 340 rows were exact duplicates from API retry errors, the “deal_value” column contained strings like “₹2,50,000” and “3.5L” and “250000” in the same column, city names included “Hyderabad,” “hyderabad,” “HYDERABAD,” and “Secunderabad” (which the team considered part of Hyderabad), dates were stored as “15-Jan-2026” in some rows and “01/15/2026” in others, and 23 records had deal values exceeding ₹5 crore which were clearly data entry errors (monthly deals entered as annual). The sales manager wanted a clean quarterly revenue report by city, but every pivot table Arjun built produced incorrect totals because of these issues.
After (The Cleaning Pipeline)
Arjun applied the 5-step pipeline in a Jupyter Notebook:
- Inspect:
df.info()revealed deal_value wasobjecttype (string), 5 columns had missing values, and the DataFrame had 18,340 rows (340 more than expected). - Duplicates:
df.drop_duplicates(subset=['deal_id'], keep='first')removed 340 API-retry duplicates, leaving 18,000 rows. - Strings: City names standardised using
str.strip().str.title()plus a mapping dictionary that merged “Secunderabad” into “Hyderabad.” Phone numbers cleaned to 10 digits using regex. - Data types: Deal values cleaned by stripping “₹” and commas, converting “3.5L” to 350000 using a custom function, then
pd.to_numeric(errors='coerce'). Dates parsed withpd.to_datetime()usingdayfirst=Truefor DD/MM format rows. - Outliers: 23 records with deal values above ₹5 crore flagged using IQR method. Investigation confirmed they were monthly values entered as annual — divided by 12 and corrected.
- Missing values: 1,200 missing phone numbers filled with “Not Available” (these were inbound web leads with no phone capture). Missing deal values (14 rows after coercion) dropped as they were unrecoverable.
Result
The cleaned dataset had 17,986 rows with consistent data types, standardised city names, and accurate deal values. The quarterly revenue report now showed Hyderabad as one city (not four variants) with ₹4.2 crore in Q1 revenue. The sales manager identified that Chennai was underperforming by 28% — a finding that was invisible in the dirty data because “Chennai” and “Madras” were counted as separate cities. Total cleaning time: 45 minutes. Impact: a reliable revenue report that drove a strategic decision to increase the Chennai sales team by two executives. The entire pipeline was saved as a reusable Jupyter Notebook that the team now runs on every monthly CRM export.
Common Mistakes in Data Cleaning (and How to Avoid Them)
- Mistake: Cleaning data in the original file.
Fix: Always work on a copy. Load the original CSV into a DataFrame, perform all cleaning operations, and export to a new file (sales_cleaned.csv). Never overwrite the source file. If your cleaning logic has a bug, you need the original data to start over. Professional analysts maintain both raw and cleaned versions in separate folders. - Mistake: Dropping all rows with any missing value.
Fix:df.dropna()without parameters drops every row that has even one missing value in any column. In a 20-column dataset, this can eliminate 60-80% of your data. Always usesubsetto specify which columns are critical:df.dropna(subset=['email','deal_value']). Keep rows that are missing non-essential fields. - Mistake: Letting Pandas guess date formats.
Fix:pd.to_datetime(df['date'])without a format parameter guesses — and in Indian datasets, it will interpret “01/02/2026” as January 2 instead of February 1. Always specify:pd.to_datetime(df['date'], format='%d/%m/%Y')or usedayfirst=True. This single mistake has caused incorrect monthly reports in countless Indian organisations. - Mistake: Deleting outliers without investigation.
Fix: An outlier is not automatically an error. A transaction of ₹50 lakh in a dataset averaging ₹50,000 could be a data entry error — or it could be a legitimate enterprise deal. Flag outliers, investigate them, and then decide: correct (if error), cap (if extreme but valid), or keep (if legitimate). Document your decision for each outlier category. - Mistake: Not validating after cleaning.
Fix: Rundf.info(),df.describe(), anddf.duplicated().sum()after every cleaning step. Use assert statements to enforce expectations. If your cleaned “amount” column still has negative values or your “date” column still has entries from 1900, your cleaning was incomplete. Validation is not optional — it is the step that catches bugs in your cleaning logic.
Frequently Asked Questions
What is data cleaning in Python Pandas?
Data cleaning in Python Pandas is the process of detecting and correcting errors, inconsistencies, and missing values in a dataset using the Pandas library’s built-in methods. It includes handling missing values (dropna, fillna, interpolate), removing duplicate rows (drop_duplicates), converting data types (astype, to_datetime, to_numeric), standardising text (str.strip, str.lower, str.replace), detecting outliers (IQR, Z-score), and merging datasets (merge, concat). It is the most time-consuming and most critical step in any data analysis workflow.
Why is data cleaning important for data analysts in India?
Indian datasets have unique quality challenges that make cleaning especially critical: phone numbers with inconsistent +91/0 prefixes, city names with historical variants (Bombay/Mumbai, Madras/Chennai, Calcutta/Kolkata, Bangalore/Bengaluru), dates in DD/MM/YYYY format that clash with American MM/DD/YYYY parsing, and currency values in the Indian lakh-crore numbering system. Without proper cleaning, analyses produce incorrect results — a sales report that splits Mumbai and Bombay into two cities, or a revenue chart that misparses ₹1,00,000 as 100.000. Data cleaning skills also appear in 70%+ of data analyst interview rounds in India.
How do I handle missing values in Pandas?
Pandas provides three strategies: dropna() removes rows or columns with missing values — use it when less than 5% of data is affected. fillna() replaces missing values with a specified value, the column mean, median, or mode — use it when 5-30% is missing and you have a sensible replacement. interpolate() estimates missing values based on surrounding data points — use it for time-series data where values change gradually. The choice depends on the percentage of missing data, the column’s importance, and the data distribution. Never use dropna() without the subset parameter on wide datasets — it will eliminate most of your rows.
What is the difference between dropna and fillna in Pandas?
dropna() removes entire rows (or columns) that contain missing values. It reduces your dataset size. Use it when the missing data is a small percentage and the remaining data is sufficient for analysis. fillna() replaces missing values with a substitute — a constant, the column mean, median, or mode. It preserves your dataset size. Use it when you cannot afford to lose rows or when you have a statistically valid replacement. For example, filling missing salary values with the median salary preserves the row while introducing minimal bias. Filling with the mean is less robust because the mean is sensitive to outliers.
How do I remove duplicate rows in Pandas?
Use df.drop_duplicates() to remove exact duplicate rows. For partial duplicates (rows that match on specific columns but differ on others), use df.drop_duplicates(subset=['column1', 'column2']). The keep parameter controls which duplicate to retain: 'first' (default) keeps the first occurrence, 'last' keeps the last, and False removes all duplicates including the original. In Indian datasets, always deduplicate on business keys (order_id, phone number, email) rather than removing exact row matches, because duplicates often have slight differences in non-key columns due to data entry variations.
How do I clean Indian phone numbers in Pandas?
Indian phone numbers appear in many formats in datasets: +91-9876543210, 09876543210, 91 98765 43210, 9876543210. Use a three-step regex cleaning approach: first, remove all non-digit characters with str.replace(r'[^0-9]', '', regex=True). Second, remove the 91 country code prefix with str.replace(r'^91', '', regex=True). Third, remove the leading 0 trunk prefix with str.replace(r'^0', '', regex=True). This produces a clean 10-digit number. Validate by checking that the result has exactly 10 digits and starts with 6, 7, 8, or 9 (valid Indian mobile number prefixes).
What tools can I use for data cleaning with Pandas?
The two primary environments for Pandas data cleaning are Jupyter Notebook (installed locally via pip install notebook) and Google Colab (free, cloud-based, no installation required). Jupyter Notebook provides a cell-by-cell workflow where you can inspect results at each step — ideal for data cleaning because you need to verify each transformation. Google Colab offers the same Jupyter interface with free GPU access, automatic Pandas installation, and easy sharing via Google Drive. Both support Pandas 2.x, Matplotlib for visualisation, and all cleaning methods discussed in this guide. For large datasets (millions of rows), consider Polars or Dask, which are Pandas-compatible libraries optimised for performance.
What data cleaning questions are asked in data analyst interviews in India?
The most common interview questions: (1) How do you handle missing values? Explain dropna vs fillna vs interpolate with use cases. (2) How do you remove duplicates based on specific columns? Demonstrate drop_duplicates(subset=...). (3) How do you convert data types? Show astype, to_datetime, to_numeric. (4) How do you detect outliers? Explain IQR and Z-score methods. (5) How do you merge two DataFrames? Demonstrate merge with inner, left, right, and outer joins. (6) Write code to clean a messy phone number column. (7) Write code to standardise city names in a dataset. (8) What is the difference between merge, concat, and join? Candidates who can write clean, working code for these questions in a coding round are significantly more competitive for roles paying ₹6-12 LPA.
Your Next Step
Data cleaning is where data analysis begins — not as a preliminary chore, but as the skill that determines whether every chart, report, and model you build afterward is trustworthy or misleading. The 80% statistic is not a complaint; it is a reflection of how much real-world data quality matters. Indian datasets add their own layer of complexity with phone number formats, city name variants, date conventions, and currency formatting that break standard parsing assumptions. The analysts who master these cleaning patterns — who can take a messy 18,000-row CRM export and transform it into a reliable, analysis-ready dataset in under an hour — are the ones who earn the confidence of their managers, produce reports that drive real business decisions, and command salaries at the higher end of the ₹4-12 LPA range.
Pandas gives you every tool you need. dropna, fillna, drop_duplicates, astype, to_datetime, str.replace, IQR-based outlier detection, merge, concat — these methods are your daily instruments. The pipeline is always the same: load, inspect, clean, validate, export. Build it once in a Jupyter Notebook, and you have a reusable template for every dataset you encounter.
If you want to build these skills systematically — with structured projects on real Indian datasets, mentor-guided practice on cleaning pipelines, and interview preparation that covers the exact coding questions companies ask — a focused Data Analytics programme can compress months of self-learning into weeks of guided practice.