PANDAS

Pandas Tutorial – From Zero to Confidently Useful

0. What is Pandas, really?

Pandas = Excel + SQL + Python superpowers in one library

Main things you use every day:

  • DataFrame → like a table / spreadsheet
  • Series → like one column (or one row sometimes)

Most common import line in the world:

Python

(Everyone uses pd as the alias — just do it)

1. How to create a DataFrame (5 most common ways)

Python

Quick check:

Python

2. Selecting data – the 4 most important ways

You want Syntax Result type
One column df[‘salary’] Series
Multiple columns df[[‘name’,’age’]] DataFrame
Rows by position df.iloc[0:3] DataFrame
Rows by condition df[df[‘age’] > 25] DataFrame
Rows + specific columns df.loc[df[‘age’] > 25, [‘name’,’city’]] DataFrame

Very common patterns you will write 1000 times:

Python

3. Filtering – the cheat sheet people actually use

Python

4. Adding / Changing columns

Python

5. Missing values – how everyone actually handles them

Python

6. GroupBy – the real power of pandas

Python

Popular groupby patterns:

Python

7. Merging / Joining tables (like VLOOKUP / SQL JOIN)

Python

Quick mnemonic:

how= Keeps Like SQL
left all from left LEFT JOIN
right all from right RIGHT JOIN
inner only matching INNER JOIN
outer everything + NaN where missing FULL OUTER

8. Quick real-world mini-project example

Python

Quick Reference Table – 80/20 Pandas

Task Code example
Read CSV pd.read_csv(‘file.csv’)
Filter rows df[df[‘age’] > 30]
Select columns df[[‘name’,’salary’]]
Sort df.sort_values(‘salary’, ascending=False)
New column df[‘bonus’] = df[‘salary’] * 0.1
Group & aggregate df.groupby(‘city’)[‘salary’].mean()
Merge tables pd.merge(df1, df2, on=’id’, how=’left’)
Handle missing df.fillna(0) or df.dropna()
String contains df[df[‘name’].str.contains(‘Rah’)]
Date part df[‘month’] = df[‘date’].dt.month

What would you like to practice next?

  • Reading & cleaning real messy CSV
  • GroupBy + Pivot tables in detail
  • Working with dates & time series
  • Merging multiple files together
  • Creating beautiful summary tables

Just tell me which direction you want to go deeper! 😄