Olympics Data Analysis
Use Olympics medals/athletes data to:
- Rank countries by medals
- See trends over years
- Identify top sports
Analysis pipeline
Section titled “Analysis pipeline”flowchart LR A["Raw results"] --> B["Count
(medals per country)"] B --> C["Rank
(sort_values, top 10)"] C --> D["Visualize
(bar chart)"] D --> E["Trend
(medals by year)"]
Step 1: Load
Section titled “Step 1: Load”import pandas as pd
df = pd.read_csv("data/olympics.csv")
print(df.head())Step 2: Basic counts
Section titled “Step 2: Basic counts”medals = df.groupby("country").size().sort_values(ascending=False).head(10)
print(medals)Step 3: Plot top countries
Section titled “Step 3: Plot top countries”import matplotlib.pyplot as plt
plt.figure(figsize=(10, 4))
plt.bar(medals.index, medals.values)
plt.title("Top 10 countries by medals")
plt.xticks(rotation=25)
plt.tight_layout()
plt.show()Visualize it
Section titled “Visualize it”Deliverable
Section titled “Deliverable”- Top 10 countries
- Change over years
- Sports that contribute most
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Medal counts per country
Section titled “Exercise 1 – Medal counts per country”Exercise 2 – Top N ranking
Section titled “Exercise 2 – Top N ranking”Exercise 3 – Medals by year (trend)
Section titled “Exercise 3 – Medals by year (trend)”pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading