Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Boxplot showes incorrect picture

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

you should remove the outliers with the showfliers option:

#... 
sns.boxplot(x='UniqueCarrier', y='Month', data=data, order=result.index, showfliers = False)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading