#!usr/bin/env python
#-*- coding:utf-8 _*-
'''
@author:Administrator
@file: pandas_dataframe_cases1.py
@time: 2020-01-05 下午 3:25
本案例是统计:店铺总数排名前10的国家
'''
import pandas as pd
from matplotlib import pyplot as plt
file_path = "../data/starbucks_store_worldwide.csv"
df = pd.read_csv(file_path);
catory_data=df.groupby(by="Country").count()
print(catory_data)
top_data=catory_data["Store Number"].sort_values(ascending=False)[:10]
print(top_data)
x=top_data.index;
y=top_data.values;
#画图
plt.figure(figsize=(20,8),dpi=70)
plt.bar(range(len(x)),y)
plt.xticks(range(len(x)),x)
plt.show();