← Blog
BEGINNER TUTORIAL — INDIA 2026

Python for Data Analysis India 2026
pandas, matplotlib & EDA from Scratch

Learn Python for data analysis step by step — no prior programming experience needed. Every concept uses Indian business data (sales, customers, e-commerce) with runnable code you can copy into Google Colab right now.

Ch 1Ch 2Ch 3Ch 4Ch 5Ch 6Ch 7Ch 8
Python Interview Q&A →Live Python Training →
What you will learn in this tutorial
pandas DataFrame basicsBeginner
Filtering and selecting dataBeginner
GroupBy and aggregationsIntermediate
Data cleaning (real messy data)Intermediate
matplotlib chartsIntermediate
seaborn statistical plotsIntermediate
Complete EDA projectAdvanced
Interview-ready Python patternsAdvanced
1

Why Python for Data Analysis — and How it Compares to Excel

Python is not a replacement for Excel — it is a complement. Excel handles structured, small-to-medium datasets beautifully. Python handles large datasets (100,000+ rows), automation, and statistical analysis that Excel cannot do cleanly.

For Indian data analyst roles in 2026, Python is most valued for: cleaning messy raw data from APIs or databases, running exploratory data analysis (EDA) on large datasets, automating repetitive analysis tasks, and producing reproducible analytical work that teammates can rerun.

You do not need programming experience to start. If you can write an Excel formula or a SQL query, you already think analytically — Python is just a different syntax for the same logical process.

2

Setting Up Python — Jupyter Notebook and Google Colab

The fastest way to start Python for data analysis is Google Colab — a free browser-based Jupyter Notebook that requires no installation. Open colab.research.google.com, create a new notebook, and start running Python immediately.

For local setup: install Anaconda (anaconda.com/download) — it installs Python, Jupyter Notebook, and all major data libraries in one package. This is the standard setup for data analysts in India.

A Jupyter Notebook runs code in cells. Each cell is a unit of code you run independently — useful for step-by-step analysis where you want to see intermediate results.

# Verify your setup — run this in a new notebook cell
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

print("pandas version:", pd.__version__)
print("numpy version:", np.__version__)
print("Setup complete ✓")
3

pandas Basics — Loading and Exploring Data

pandas is the core library for data analysis in Python. A DataFrame is pandas' main data structure — think of it as an Excel sheet with rows and columns, but with far more powerful operations.

The most common first step in any analysis is loading a dataset and understanding its shape — how many rows, how many columns, what data types, and whether there are missing values.

import pandas as pd

# Load a CSV file
df = pd.read_csv('sales_data.csv')

# First look at the data
print(df.shape)          # (rows, columns)
print(df.head())         # first 5 rows
print(df.tail(3))        # last 3 rows
print(df.info())         # column names, dtypes, non-null counts
print(df.describe())     # summary statistics for numeric columns

# Check for missing values
print(df.isnull().sum())

# Check column names
print(df.columns.tolist())

# Basic counts
print(f"Total orders: {len(df)}")
print(f"Unique customers: {df['customer_id'].nunique()}")
print(f"Date range: {df['order_date'].min()} to {df['order_date'].max()}")
4

Filtering and Selecting — The pandas Equivalent of SQL WHERE

Filtering in pandas uses boolean conditions — expressions that evaluate to True or False for each row. Use & for AND, | for OR, and ~ for NOT. Always wrap individual conditions in parentheses when combining them.

.loc[] selects by label (row index or column name). .iloc[] selects by integer position. For most data analysis work, use .loc[] with column names — it is more readable and less error-prone.

# Filter orders above ₹50,000
high_value = df[df['amount'] > 50000]

# Filter by city AND amount
delhi_high = df[(df['city'] == 'Delhi') & (df['amount'] > 50000)]

# Filter by multiple cities (isin — like SQL IN)
ncr_orders = df[df['city'].isin(['Delhi', 'Noida', 'Gurgaon'])]

# Filter rows where delivery_date is missing
undelivered = df[df['delivery_date'].isnull()]

# Filter orders in 2025 (after parsing date)
df['order_date'] = pd.to_datetime(df['order_date'])
orders_2025 = df[df['order_date'].dt.year == 2025]

# Select specific columns
summary = df[['customer_id', 'city', 'amount', 'order_date']]

# Select column as a Series
amounts = df['amount']           # Series
amounts_df = df[['amount']]      # DataFrame (one column)

# .loc example — rows where city is Noida, show name and amount
df.loc[df['city'] == 'Noida', ['name', 'amount']]
5

GroupBy and Aggregation — The pandas Equivalent of SQL GROUP BY

groupby() splits the DataFrame into groups and applies an aggregation function to each group. The result is a new DataFrame with one row per group — identical in concept to SQL's GROUP BY.

agg() allows multiple aggregation functions at once. reset_index() converts the group keys back to regular columns (needed for further processing or plotting).

# Total sales by city
city_sales = df.groupby('city')['amount'].sum().reset_index()
city_sales.columns = ['city', 'total_sales']
city_sales = city_sales.sort_values('total_sales', ascending=False)
print(city_sales)

# Multiple aggregations at once
city_summary = df.groupby('city').agg(
    total_sales   = ('amount', 'sum'),
    order_count   = ('order_id', 'count'),
    avg_order     = ('amount', 'mean'),
    unique_customers = ('customer_id', 'nunique')
).reset_index()

# Group by two columns — sales by city and product category
city_cat = df.groupby(['city', 'category'])['amount'].sum().reset_index()

# Filter groups (equivalent of HAVING in SQL)
# Cities with total sales above ₹10,00,000
high_cities = city_sales[city_sales['total_sales'] > 1_000_000]

# Monthly sales trend
df['month'] = df['order_date'].dt.to_period('M')
monthly = df.groupby('month')['amount'].sum().reset_index()
monthly.columns = ['month', 'revenue']
6

Data Cleaning — The Most Important Real-World Skill

Real-world data is messy. In India, datasets from HRIS systems, ERP exports, Excel files shared over WhatsApp, and web scrapers are almost always dirty. Data cleaning is the most time-consuming part of any analyst's job — and doing it well is what separates analysts who produce reliable insights from those who produce wrong ones.

Common issues: missing values (NaN), wrong data types (dates stored as text, amounts as strings with ₹ signs), duplicates, inconsistent category names ("Delhi", "delhi", "DELHI"), outlier values.

# --- Missing values ---
# Drop rows where 'amount' is missing
df_clean = df.dropna(subset=['amount'])

# Fill missing city with 'Unknown'
df['city'] = df['city'].fillna('Unknown')

# Fill missing amount with median (better than mean for skewed data)
df['amount'] = df['amount'].fillna(df['amount'].median())

# --- Data type fixing ---
# Convert amount stored as string (e.g., "₹45,000") to numeric
df['amount'] = df['amount'].str.replace('₹', '').str.replace(',', '').astype(float)

# Parse date column
df['order_date'] = pd.to_datetime(df['order_date'], dayfirst=True)

# --- Duplicates ---
print(f"Duplicates: {df.duplicated().sum()}")
df = df.drop_duplicates()

# Duplicates based on specific columns only
df = df.drop_duplicates(subset=['order_id'], keep='first')

# --- Inconsistent categories ---
# Standardise city names to title case
df['city'] = df['city'].str.strip().str.title()

# Map variants to a canonical name
city_map = {'Delhi NCR': 'Delhi', 'New Delhi': 'Delhi', 'NOIDA': 'Noida'}
df['city'] = df['city'].replace(city_map)

# --- Outliers ---
# Flag orders with amount beyond 3 standard deviations
mean, std = df['amount'].mean(), df['amount'].std()
df['is_outlier'] = (df['amount'] - mean).abs() > 3 * std
print(f"Outliers found: {df['is_outlier'].sum()}")
7

Visualisation — matplotlib and seaborn

matplotlib is Python's base plotting library. seaborn builds on it with more attractive statistical charts requiring less code. For data analyst work, know how to produce: bar charts (comparisons), line charts (trends over time), histograms (distributions), scatter plots (relationships), and heatmaps (correlations).

Always label your axes, add a title, and use plt.tight_layout() to prevent labels overlapping.

import matplotlib.pyplot as plt
import seaborn as sns

# Set a clean style
sns.set_style('whitegrid')

# --- Bar chart: top 10 cities by revenue ---
top_cities = city_sales.nlargest(10, 'total_sales')
plt.figure(figsize=(10, 5))
sns.barplot(data=top_cities, x='city', y='total_sales', palette='Blues_d')
plt.title('Top 10 Cities by Revenue', fontsize=14, fontweight='bold')
plt.xlabel('City')
plt.ylabel('Total Sales (₹)')
plt.xticks(rotation=45)
plt.tight_layout()
plt.savefig('top_cities.png', dpi=150)
plt.show()

# --- Line chart: monthly revenue trend ---
plt.figure(figsize=(12, 4))
monthly['month_str'] = monthly['month'].astype(str)
plt.plot(monthly['month_str'], monthly['revenue'], marker='o', color='#1d4ed8', linewidth=2)
plt.title('Monthly Revenue Trend 2025', fontsize=14, fontweight='bold')
plt.xlabel('Month')
plt.ylabel('Revenue (₹)')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

# --- Histogram: order value distribution ---
plt.figure(figsize=(8, 4))
sns.histplot(df['amount'], bins=30, kde=True, color='#166534')
plt.title('Order Value Distribution', fontsize=14, fontweight='bold')
plt.xlabel('Order Amount (₹)')
plt.tight_layout()
plt.show()

# --- Heatmap: correlation matrix ---
numeric_cols = df.select_dtypes(include='number')
plt.figure(figsize=(8, 6))
sns.heatmap(numeric_cols.corr(), annot=True, fmt='.2f', cmap='coolwarm', center=0)
plt.title('Correlation Matrix')
plt.tight_layout()
plt.show()
8

Complete EDA Project — Indian E-commerce Sales Dataset

Exploratory Data Analysis (EDA) is the structured process of understanding a dataset before drawing conclusions. In an interview, you may be given a dataset and asked to "explore it" — this is what EDA means in practice. A good EDA answers: What is the shape of the data? Are there missing values? What are the distributions of key variables? What are the top categories? Are there trends over time? What correlations exist?

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# 1. Load and inspect
df = pd.read_csv('ecommerce_india.csv')
print(f"Shape: {df.shape}")
print(df.dtypes)
print(df.isnull().sum())

# 2. Clean
df['order_date'] = pd.to_datetime(df['order_date'])
df['amount'] = pd.to_numeric(df['amount'], errors='coerce')
df = df.dropna(subset=['amount', 'order_date'])
df = df.drop_duplicates(subset=['order_id'])

# 3. Feature engineering
df['month'] = df['order_date'].dt.to_period('M')
df['year']  = df['order_date'].dt.year
df['dow']   = df['order_date'].dt.day_name()   # day of week

# 4. Summary statistics
print("
--- Key Metrics ---")
print(f"Total orders: {len(df):,}")
print(f"Total revenue: ₹{df['amount'].sum():,.0f}")
print(f"Average order value: ₹{df['amount'].mean():,.0f}")
print(f"Median order value: ₹{df['amount'].median():,.0f}")
print(f"Unique customers: {df['customer_id'].nunique():,}")

# 5. Top categories by revenue
cat_rev = df.groupby('category')['amount'].sum().sort_values(ascending=False)
print("
Top 5 categories:
", cat_rev.head())

# 6. Monthly trend
monthly = df.groupby('month')['amount'].sum()

# 7. RFM-style customer segmentation
rfm = df.groupby('customer_id').agg(
    total_orders = ('order_id', 'count'),
    total_spend  = ('amount', 'sum'),
    last_order   = ('order_date', 'max')
).reset_index()
rfm['days_since'] = (df['order_date'].max() - rfm['last_order']).dt.days

print("
Top customers by spend:
", rfm.nlargest(5, 'total_spend'))
Continue learning
Python Interview Q&A (30 questions)SQL Tutorial for BeginnersFull Skills ChecklistAnalytics vs Data Science

Frequently Asked Questions

Is Python necessary for a data analyst job in India in 2026?

Python is increasingly important but not universally required. Entry-level data analyst jobs in India in 2026 often list Python as "preferred" rather than mandatory — you can get hired with Excel, SQL, and Power BI alone. However, mid-level and senior analyst roles at IT services companies, GCCs, e-commerce firms, and startups increasingly expect Python proficiency (pandas, data cleaning, EDA). Learning Python significantly expands the number and quality of roles you can apply to. If you plan a career in data for more than 2–3 years, investing in Python early pays off.

How long does it take to learn Python for data analysis in India?

With 1–2 hours of daily practice, most beginners can learn Python basics (variables, loops, functions) and core data analysis libraries (pandas, matplotlib) in 8–12 weeks. Reaching interview-level proficiency — where you can clean a messy dataset, perform EDA, and explain your findings — takes 4–6 months of consistent hands-on work on real datasets. Python is one of those languages where reading tutorials does not build skill — you must write code on actual data every day.

Which Python libraries should a data analyst learn first in India?

Learn in this order: (1) pandas — the core library for data manipulation; 80% of your Python data work will use pandas; (2) numpy — numerical arrays and mathematical operations, used alongside pandas; (3) matplotlib — basic charts and plots; (4) seaborn — beautiful statistical visualisations built on matplotlib; (5) scipy and statsmodels — for statistical tests (t-test, chi-square, correlation) as needed. Avoid jumping to machine learning libraries (scikit-learn, TensorFlow) until you are comfortable with these five — data analysts are tested on pandas and EDA, not neural networks.

What Python topics are asked in data analyst interviews in India?

Indian data analyst interviews test Python across these areas: (1) pandas — reading CSV/Excel files, filtering DataFrames, groupby aggregations, merge/join, handling nulls; (2) data cleaning — removing duplicates, fixing dtypes, replacing values, handling missing data; (3) EDA — describing data, finding outliers, correlation matrices; (4) basic matplotlib/seaborn — drawing a bar chart, histogram, or scatter plot and explaining what it shows; (5) writing clean, readable Python functions. Machine learning is rarely tested for analyst roles — focus on data manipulation and EDA.

EVIKA ACADEMY · NOIDA SECTOR 51 · LIVE PYTHON TRAINING

Learn Python on real datasets with a live instructor

Doubt clearing in real time. EDA projects for your portfolio. Interview prep included. Free demo first.

Book Free Demo →