Skip to content
KPHB Colony, Kukatpally, Hyderabad Mon–Sat · 9 AM – 9 PM +91 96664 47822 Free demo class — book your seat

Python Resources

Python for Data: A Practical Reference

The Python, NumPy and pandas patterns you will reach for every day in data work — with short, copy-ready examples.

Level: Beginner

Core data structures

  • list — ordered, changeable: [1, 2, 3]
  • tuple — ordered, unchangeable: ("a", 1)
  • dict — key → value lookup: {"name": "Asha", "score": 91}
  • set — unique values: {"python", "sql"}
python
scores = {"Asha": 91, "Ravi": 78, "Meena": 85}
for name, score in scores.items():
    print(f"{name}: {score}")

top = max(scores, key=scores.get)   # 'Asha'

Comprehensions and functions

Comprehensions build collections in one readable line. Functions keep logic reusable and testable.

python
squares = [n * n for n in range(10)]
passed = {k: v for k, v in scores.items() if v >= 80}

def grade(score: int) -> str:
    """Return a letter grade for a numeric score."""
    if score >= 90:
        return "A"
    if score >= 75:
        return "B"
    return "C"

NumPy essentials

NumPy arrays are fast, fixed-type containers for numerical work. Operations apply to every element at once (vectorisation).

python
import numpy as np

a = np.array([4, 8, 15, 16, 23, 42])
a.mean(), a.std(), a.max()
a[a > 10]                 # boolean filtering
(a - a.mean()) / a.std()  # standardise

pandas: load, inspect, select

python
import pandas as pd

df = pd.read_csv("sales.csv")
df.head()          # first rows
df.info()          # columns, types, nulls
df.describe()      # summary statistics

df["region"]                         # one column
df[["region", "revenue"]]            # several columns
df[df["revenue"] > 10000]            # filter rows
df.loc[df["region"] == "South", "revenue"]

pandas: clean and transform

python
df = df.dropna(subset=["revenue"])
df["order_date"] = pd.to_datetime(df["order_date"])
df["month"] = df["order_date"].dt.to_period("M")
df["region"] = df["region"].str.strip().str.title()
df = df.rename(columns={"qty": "quantity"})

pandas: group, aggregate, join

python
summary = (
    df.groupby("region")
      .agg(total=("revenue", "sum"), orders=("order_id", "count"))
      .sort_values("total", ascending=False)
)

merged = df.merge(customers, on="customer_id", how="left")
pivot = df.pivot_table(index="month", columns="region", values="revenue", aggfunc="sum")

Quick plotting

python
import matplotlib.pyplot as plt

summary["total"].plot(kind="bar", title="Revenue by region")
plt.tight_layout()
plt.show()

Habits that make you faster

  • Work in Jupyter for exploration, then move stable code into .py files
  • Use virtual environments (venv or conda) per project
  • Prefer vectorised pandas/NumPy operations over Python loops
  • Name variables for what they hold — revenue_by_region, not df2
  • Version your work with Git from day one

Go deeper with our Data Analytics + GenAI + Agentic AI program

Turn self-study into structured, project-based learning with mentor guidance.

Chat on WhatsApp