text_html_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

meat = pd.read_csv('/kaggle/input/meat-consumption/meat_consumption.csv')
meat

meat.drop(['frequency', 'indicator'], axis=1, inplace=True)
meat

meat['KG_CAP values'] = meat['value']
conversion_factor = 1000
meat.loc[meat['measure'] == 'THND_TONNE', 'KG_CAP values'] *= conversion_factor
meat

grouped_data = meat.groupby('subject')['KG_CAP values'].agg(['sum', 'mean'])
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 10))
colors = ['blue', 'green', 'orange', 'red']
ax1.bar(grouped_data.index, grouped_data['sum'], color=colors)
ax1.set_ylabel('Total mean consumed')
ax1.set_xticklabels(grouped_data.index, rotation=45, ha='right')
for i, v in enumerate(grouped_data['sum']):
    ax1.text(i, v, str(v), ha='center', va='bottom')
ax2.bar(grouped_data.index, grouped_data['mean'], color=colors)
ax2.set_ylabel('Mean consumption of meat')
ax2.set_xticklabels(grouped_data.index, rotation=45, ha='right')
for i, v in enumerate(grouped_data['mean']):
    ax2.text(i, v, str(v), ha='center', va='bottom')
plt.xlabel('Type of meat')
plt.suptitle('Total and mean consumption of meat')
plt.tight_layout()
plt.show()