In python:
fig1, ax1 = plt.subplots()
ax1.set_title('Basic Plot')
ax1.boxplot(data)
The IQR can be calculated with:
IQR = stats.iqr(data, interpolation = 'midpoint')
How would I obtain the min and max values "The Whiskers" for each box blot?
In python:
fig1, ax1 = plt.subplots()
ax1.set_title('Basic Plot')
ax1.boxplot(data)
The IQR can be calculated with:
IQR = stats.iqr(data, interpolation = 'midpoint')
How would I obtain the min and max values "The Whiskers" for each box blot?
Dataframe has the quantile function:
Q1 = df["COLUMN_NAME"].quantile(0.25)
Q3 = df["COLUMN_NAME"].quantile(0.75)
IQR = Q3 - Q1
Lower_Fence = Q1 - (1.5 * IQR)
Upper_Fence = Q3 + (1.5 * IQR)
Thus you would have to get the first value less than the fence value
def iqr_fence(x):
Q1 = x.quantile(0.25)
Q3 = x.quantile(0.75)
IQR = Q3 - Q1
Lower_Fence = Q1 - (1.5 * IQR)
Upper_Fence = Q3 + (1.5 * IQR)
u = max(x[x<Upper_Fence])
l = min(x[x>Lower_Fence])
return [u,l]