Methods & Tools¶
Data Sources
- [Dataset name and source]
- [Dataset name and source]
Processing Steps
- Load and clean raw data
- Compute summary statistics
- Visualise trends with a pandas chart
- Map spatial distribution with Folium
Tools Used
| Tool | Purpose |
|---|---|
| pandas | Data loading, cleaning, aggregation |
| matplotlib | Static charts |
| folium | Interactive web maps |
Setup¶
In [1]:
Copied!
import pandas as pd
import matplotlib.pyplot as plt
import folium
import pandas as pd
import matplotlib.pyplot as plt
import folium
In [ ]:
Copied!
# Placeholder time-series data
# Replace with: df = pd.read_csv("your_data.csv")
data = {
"month": ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
"metric_a": [120, 135, 148, 162, 175, 190, 185, 178, 160, 145, 130, 118],
"metric_b": [ 80, 88, 95, 105, 112, 120, 118, 110, 100, 92, 85, 78],
}
df = pd.DataFrame(data)
df.head()
# Placeholder time-series data
# Replace with: df = pd.read_csv("your_data.csv")
data = {
"month": ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
"metric_a": [120, 135, 148, 162, 175, 190, 185, 178, 160, 145, 130, 118],
"metric_b": [ 80, 88, 95, 105, 112, 120, 118, 110, 100, 92, 85, 78],
}
df = pd.DataFrame(data)
df.head()
In [ ]:
Copied!
df[["metric_a", "metric_b"]].describe()
df[["metric_a", "metric_b"]].describe()
Trend chart¶
In [4]:
Copied!
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(df["month"], df["metric_a"], marker="o", label="Metric A", color="steelblue")
ax.plot(df["month"], df["metric_b"], marker="s", label="Metric B", color="coral")
ax.set_title("[YOUR CHART TITLE]", fontsize=14, fontweight="bold")
ax.set_xlabel("Month")
ax.set_ylabel("[Unit]")
ax.legend()
ax.grid(axis="y", linestyle="--", alpha=0.5)
plt.tight_layout()
plt.show()
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(df["month"], df["metric_a"], marker="o", label="Metric A", color="steelblue")
ax.plot(df["month"], df["metric_b"], marker="s", label="Metric B", color="coral")
ax.set_title("[YOUR CHART TITLE]", fontsize=14, fontweight="bold")
ax.set_xlabel("Month")
ax.set_ylabel("[Unit]")
ax.legend()
ax.grid(axis="y", linestyle="--", alpha=0.5)
plt.tight_layout()
plt.show()
Grouped bar chart¶
Spatial Distribution¶
Interactive map of placeholder sample points — replace coordinates and popup text with your own data.
In [7]:
Copied!
# Placeholder point locations
# Replace with your own lat/lon data, e.g. from a GeoDataFrame or CSV
sites = pd.DataFrame({
"name": ["Site A", "Site B", "Site C", "Site D", "Site E"],
"lat": [28.61, 28.65, 28.58, 28.70, 28.55],
"lon": [77.20, 77.23, 77.17, 77.28, 77.15],
"value": [142, 168, 95, 210, 87],
})
# Centre the map on the mean location
m = folium.Map(
location=[sites["lat"].mean(), sites["lon"].mean()],
zoom_start=11,
tiles="CartoDB positron",
)
# Add a CircleMarker for each site, scaled by value
for _, row in sites.iterrows():
folium.CircleMarker(
location=[row["lat"], row["lon"]],
radius=row["value"] / 20, # scale radius to value
color="steelblue",
fill=True,
fill_opacity=0.7,
tooltip=f"{row['name']}: {row['value']}",
popup=folium.Popup(
f"<b>{row['name']}</b><br>Value: {row['value']}",
max_width=200,
),
).add_to(m)
m
# Placeholder point locations
# Replace with your own lat/lon data, e.g. from a GeoDataFrame or CSV
sites = pd.DataFrame({
"name": ["Site A", "Site B", "Site C", "Site D", "Site E"],
"lat": [28.61, 28.65, 28.58, 28.70, 28.55],
"lon": [77.20, 77.23, 77.17, 77.28, 77.15],
"value": [142, 168, 95, 210, 87],
})
# Centre the map on the mean location
m = folium.Map(
location=[sites["lat"].mean(), sites["lon"].mean()],
zoom_start=11,
tiles="CartoDB positron",
)
# Add a CircleMarker for each site, scaled by value
for _, row in sites.iterrows():
folium.CircleMarker(
location=[row["lat"], row["lon"]],
radius=row["value"] / 20, # scale radius to value
color="steelblue",
fill=True,
fill_opacity=0.7,
tooltip=f"{row['name']}: {row['value']}",
popup=folium.Popup(
f"<b>{row['name']}</b><br>Value: {row['value']}",
max_width=200,
),
).add_to(m)
m
Out[7]:
Make this Notebook Trusted to load map: File -> Trust Notebook