packages = ["bokeh", "pandas", "numpy", "networkx", "diagrams", "scikit-learn", "pillow", "matplotlib", "plotly"] [[fetch]] files = ["diagrams_base.py"] from = "../../python/diagrams/" [[fetch]] files = ["pyscript_manager.py", "data.py"] to_folder = "lib" from = "../../python/lib/" [[fetch]] files = ["bokeh_utils.py"] from = "../../python/bokeh/" [[fetch]] files = ["matplotlib_utils.py", "plotly_utils.py"] from = "../../python/matplotlib/" [[fetch]] files = ["agent.py", "trainer.py", "utils.py", "metrics_chart.py", "crossover.py", "__init__.py"] to_folder = "ml/neuro" from = "../../python/ml/neuro/" [[fetch]] files = ["trainer.py"] to_folder = "ml/grokking" from = "../../python/ml/grokking/"

Loading...

COVID-19 Global Data Analysis

Visualizing pandemic data from 187 countries/regions using Matplotlib and Pandas

πŸ“Š Chart 1: Top 20 Countries by Deaths

A "heatmap-style" horizontal bar chart showing countries with the highest death tolls. The color intensity increases with death count.

Top 20 deaths with heatmap coloring:

🌍 Chart 2: Deaths by WHO Region

Pie chart showing how deaths are distributed across WHO regions (Americas, Europe, Africa, etc.)

Regional distribution using the SAME cached data:

πŸ” Chart 3: Confirmed Cases vs Deaths (Log Scale)

Scatter plot revealing the relationship between confirmed cases and deaths. Log scale makes patterns visible across countries of vastly different sizes.

Scatter plot with log scale:

⚠️ Chart 4: Case Fatality Rate Analysis

Case Fatality Rate analysis showing which countries had the highest death-to-case ratios (filtered to countries with 1000+ cases for statistical significance)

CFR analysis with filtering:

COVID-19 Data Charts

πŸ“Š The Dataset

The covid_country.csv dataset contains:

  • 187 countries/regions with cumulative statistics
  • Confirmed cases, deaths, recoveries, and active cases
  • Weekly new cases and changes
  • Case fatality rates (death rate)
  • WHO regional categorization (Americas, Europe, Africa, etc.)

πŸ“ˆ What is Matplotlib?

Matplotlib is Python's foundational plotting library. It provides complete control over every aspect of your charts - from basic line plots to complex multi-panel visualizations. Unlike Bokeh (which focuses on interactivity), Matplotlib excels at creating publication-quality static figures with precise customization.

πŸ”¬ Chart Types Used

  • Horizontal Bar Charts: Great for comparing categories when labels are long
  • Pie Charts: Show proportions of a whole (regional distribution)
  • Scatter Plots: Reveal correlations between two variables
  • Log Scales: Handle data spanning multiple orders of magnitude
  • Color Maps: Use color intensity to represent data values (heatmap effect)

πŸ’‘ Data Insights

  • The Americas and Europe regions had the highest death tolls
  • Larger outbreaks don't always correlate linearly with deaths (different healthcare responses)
  • Case Fatality Rate varies significantly based on healthcare capacity, testing rates, and demographics
  • Countries with robust testing may show lower CFR due to detecting more mild cases

🎯 Technical Techniques

  • Pandas Operations: nlargest(), groupby(), filtering with boolean indexing
  • Color Mapping: plt.cm.Reds, plt.cm.Set3, plt.cm.YlOrRd for visual hierarchy
  • Log Scales: set_xscale('log') for handling wide value ranges
  • Data Caching: All 4 charts share the same loaded CSV (efficient!)
  • Client-Side Processing: All analysis happens in your browser via WebAssembly

View source files

🐍 Python Console