Pandas Tutorial

Pandas tutorial (aimed at someone who is learning seriously and wants to really understand — not just copy-paste)

Imagine we are sitting together with a laptop, a cup of tea/coffee, and I’m explaining step by step like I would explain to my friend or a junior colleague who really wants to get good at pandas.

Pandas – Realistic, Practical, Human-friendly Guide (2025 edition)

First important sentence:

Pandas is not Excel. Pandas is not SQL. But it can do almost everything both can do — and much more — if you learn to think the pandas way.

0. Mental model – How should you picture a DataFrame?

Think of a DataFrame as:

  • A table (like Excel sheet or database table)
  • Every column is a Series (a named array with index)
  • The index is like row labels (can be numbers 0,1,2… or dates, names, IDs…)
  • Most powerful feature: you can filter, calculate, group by using the column names directly
Python

1. Creating DataFrames – the 5 ways you will actually use

Way 1 – From dictionary (cleanest & most common)

Python
text

Way 2 – From list of records (when data comes from API / JSON)

Python

Way 3 – Empty DataFrame and fill later (common in loops)

Python

2. Looking at data – the commands you use 50 times a day

Python

3. Selecting data – the four main patterns

Goal Syntax example Returns
One column students[‘marks’] Series
Multiple columns students[[‘name’,’marks’,’city’]] DataFrame
Rows by position (0-based) students.iloc[1:4] DataFrame
Rows by label (if index is custom) students.loc[‘A001’] (rare)
Rows by condition students[students[‘marks’] >= 80] DataFrame
Rows + chosen columns students.loc[students[‘age’] <= 22, [‘name’,’city’]] DataFrame

Most common real-life filters:

Python

4. Creating / Modifying columns (this is where pandas shines)

Python

5. Sorting

Python

6. Missing values – realistic handling

Python

7. GroupBy – the heart of data analysis

Python

Very common pattern – rank inside group

Python

8. Merging / Joining – like VLOOKUP ×100

Python

9. Dates & Time – quick survival kit

Python

Quick Reference – Commands you will type hundreds of times

text

What would you like to do next?

  1. Practice cleaning a messy real-world CSV together
  2. Go deeper into GroupBy + pivot_table + crosstab
  3. Work with dates & time-series (very important in 2025)
  4. Learn merging & concatenating multiple files/tables
  5. Write beautiful summary reports (style + formatting)
  6. Common mistakes & how to debug pandas code

Just tell me which path you want to walk next — I’ll go as deep as you want! 😄

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *