Home > Enterprise >  Boxplot showes incorrect picture
Boxplot showes incorrect picture

Time:01-06

I have my code which shows stats:

data = data.assign(
    ArrDelay=np.where(data["ArrDelay"].lt(0), 0, data["ArrDelay"]),
    DepDelay=np.where(data["DepDelay"].lt(0), 0, data["DepDelay"])
)
data[["ArrDelay", "DepDelay"]].head(40)
data['Month'] = (data['ArrDelay']   data['DepDelay'])

result = data.groupby("UniqueCarrier")["Month"].mean()
print(result)
sns.boxplot(x='UniqueCarrier', y='Month', data=data, order=result.index)

But the boxplot is incorrect.

There is my result: enter image description here

How I'd like it to be: enter image description here

CodePudding user response:

you should remove the outliers with the showfliers option:

#... 
sns.boxplot(x='UniqueCarrier', y='Month', data=data, order=result.index, showfliers = False)
  • Related