import pandas as pd
create_study='D:/sqlfile/19.xls'
data=pd.read_excel(create_study,index_col='排名')
data.describe()
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
plt.figure()
p=data.boxplot(return_type='dict')
x=p['fliers'][0].get_xdata()
y=p['fliers'][0].get_ydata()
y.sort()
for i in range(len(x)):
if i>0:
plt.annotate(y[i],xy=(x[i],y[i]),xytext=(x[i]+0.05 -0.8/(y[i]-y[i-1]),y[i]))
else:
plt.annotate(y[i],xy=(x[i],y[i]),xytext=(x[i]+0.08, y[i]))
plt.show()
from __future__ import print_function
import pandas as pd
create_study='D:/sqlfile/19.xls'
data=pd.read_excel(create_study,index_col='排名')
data=data[data[u'总分']>400]
staticdata=data.describe()
#极差
staticdata.loc['range']=staticdata.loc['max']-staticdata.loc['min']
#变异系数
staticdata.loc['var']=staticdata.loc['std']/staticdata.loc['mean']
#四分位数的间距
staticdata.loc['dis']=staticdata.loc['75%']-staticdata.loc['25%']
print(staticdata)