The import pandas as pd
Catering_sale='../data/catering_sale. XLS '# catering data
Data=https://bbs.csdn.net/topics/pd.read_excel (catering_sale, index_col=u 'date') # read data, specify the "date" as an indexed column
The import matplotlib. Pyplot as PLT # import image library
PLT. RcParams [' font. Sans-serif]=[' SimHei] # used to display Chinese label normal
PLT. RcParams [' axes. Unicode_minus]=False # is used to display normal minus
PLT. Figure (#) based image
P=data. Boxplot () # boxplot, directly using the method of DataFrame
X=p [' fliers] [0]. Get_xdata () # 'flies' is the outliers of tag
Y=p [' fliers] [0]. Get_ydata ()
Y.s ort (#) from small to large, sorting the method directly change the original object
# use annotate add comments
# some similar points, annotations can overlap, harder to see, need some skills to control,
# the following parameters are after debugging, specific to debug,
For I in range (len (x)) :
If i> 0:
PLT. Annotate ([I] y, y=(x [I], [I] y), xytext=(x [I] +/0.05 0.8 (y [I] - y] [I - 1), y [I]))
The else:
PLT. Annotate ([I] y, y=(x [I], [I] y), xytext=(x + 0.08 [I], [I] y))
PLT. The show () # show boxplot
A lot of places have the sample, but the following two other complains, why?
X=p [' fliers] [0]. Get_xdata () # 'flies' is the outliers of tag
Y=p [' fliers] [0]. Get_ydata ()
CodePudding user response:
The original poster information first take a look at pCodePudding user response:
Can point in detail? Could you tell me why I p under the environment of the details of the print is not so much?Will only print out:
CodePudding user response: