Global Terrorism Database Analysis
Use GTD-like incident data to:
- Visualize incidents over time
- Compare regions
- Identify major trend changes
Important note
Section titled “Important note”This is a sensitive dataset. Focus on high-level aggregated analysis and avoid sensationalizing.
Analysis pipeline
Section titled “Analysis pipeline”flowchart LR A["Raw incidents"] --> B["Aggregate
(by year, region)"] B --> C["Visualize
(trend line, top regions)"] C --> D["Caveat
(missing/reporting bias)"] D --> E["Conclude
(high-level summary)"]
Step 1: Load
Section titled “Step 1: Load”import pandas as pd
df = pd.read_csv("data/gtd.csv")
print(df.head())Step 2: Incidents by year
Section titled “Step 2: Incidents by year”import matplotlib.pyplot as plt
yearly = df.groupby("year").size()
plt.figure(figsize=(10, 4))
plt.plot(yearly.index, yearly.values)
plt.title("Incidents by year")
plt.xlabel("Year")
plt.ylabel("Count")
plt.tight_layout()
plt.show()Step 3: Compare regions
Section titled “Step 3: Compare regions”import seaborn as sns
import matplotlib.pyplot as plt
regions = df["region"].value_counts().head(10).reset_index()
regions.columns = ["region", "count"]
plt.figure(figsize=(10, 4))
sns.barplot(data=regions, x="count", y="region")
plt.title("Top regions by incident count")
plt.tight_layout()
plt.show()Visualize it
Section titled “Visualize it”Deliverable
Section titled “Deliverable”- Overall trend
- Top regions by incidents
- Notes about missingness/reporting bias
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Incidents per year
Section titled “Exercise 1 – Incidents per year”Exercise 2 – Top regions by incident count
Section titled “Exercise 2 – Top regions by incident count”Exercise 3 – Bucket missing region as “Unknown”
Section titled “Exercise 3 – Bucket missing region as “Unknown””pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading