Skip to content

04-06: Employee Analytics — Pandas Basics

Python: Data Analytics

View the live site — ijk37.com

Project 06

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Loads a 20-employee dataset from CSV and performs: department salary summaries, high-earner filtering, top-earner-per-department lookup, .apply() for salary band labels, city distribution, and sorted top-5. Exports a labelled report CSV.

Topics covered: pd.read_csv() · df.head() · df.describe() · df[df["col"] > val] · df.groupby().agg() · df.sort_values() · df["col"].apply(fn) · df.to_csv()

Difficulty: ⭐⭐ Intermediate


Requirements

pip install pandas

How to Run

python main.py

employees.csv is auto-created on first run.


Key Concepts Practised

Concept Where used
pd.read_csv() / df.to_csv() Load and save CSV
df[df["Salary"] > 70000] Boolean filtering
df.groupby("Department")["Salary"].agg(...) Grouped aggregation
df["Salary"].apply(band_fn) Add derived column
df.groupby(...).idxmax() + df.loc[idx] Top per group
df.sort_values(ascending=False).head(5) Top N