df = pd.io.json.json_normalize(data["data"])
// filter by countries with at least one medal and sort
df = df[df["medals.total"] > 0]
df = df.sort("medals.total", ascending=False)
// get the countries and group the data by medal type
countries = df.abbr.values.tolist()