Home > other >  Python matplot boxplot outliers flier error is what?
Python matplot boxplot outliers flier error is what?

Time:12-05

# - * - coding: utf-8 - * -
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 p

CodePudding 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:

refer to the second floor zcs99 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:

Don't know how the data of the building Lord come, try this
 data=https://bbs.csdn.net/topics/pd.DataFrame ({' A ': (1), 
'B' : pd. The Series (1, index=list (range (4)), dtype='float32'),
'C' : pd. Series ([1, 2, 1, 2], dtype='int32'),})
P=data. Boxplot ()

CodePudding user response:

With the landlord to solve this problem, ask!!!!!!

CodePudding user response:

P=data. Boxplot (return_type='dict')

CodePudding user response:

Why ah? Can you explain?

CodePudding user response:

P=data. Boxplot (return_type='dict'), in parentheses, combined with the code

CodePudding user response:

When the return='dict, return the result as a dictionary, there are several key values, respectively is:
Boxes: displays the quartile and the confidence interval of the median (if enabled) (in fact, the rectangle around the subject four vertices around a week)
Median: each box across lines
Whiskers: extended to no greater than abnormal value point's vertical
Caps:
borderFliers: all outliers point
Means that represents the average points or lines
Without a return value when unable to get the key value fliers, so behind the statement complains
  • Related