text_plain_output_1.png
import numpy as np

import pandas as pd

import numpy as np
import pandas as pd
import os
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
import arviz as az
data = pd.read_csv('../input/global-disaster-risk-index-time-series-dataset/world_risk_index.csv')

(len(data['Year'].unique()), np.sort(data['Year'].unique()), len(data['Region'].unique()))

data.isna().sum().sum()

def summary(col1, col2, year):
    pivot = pd.pivot_table(data, values=[col1], index=['Year', col2], aggfunc={col1: [min, max, np.mean, np.std]})
    pivot = pivot.sort_values(by=(col1, 'mean')).reindex(np.sort(data['Year'].unique()), level=0)
    return pivot.loc[year, :]

summary('Vulnerability', 'Vulnerability Category', 2019)