Suppose we have a dataset and are interested in plotting box plot. They come in handy when finding outliers. Middle line is our median. Below and above median is 1st and 3rd quartile. Remaining are 0th and 4th. Singular point if found are outliers.
So this recipe is a short example on How to generate box plot using pandas on a column. Let's get started.
import pandas as pd import seaborn as sb
Let's pause and look at these imports. Pandas is generally used for performing mathematical operation and preferably over arrays. Seaborn is just used in here to import dataset.
df = sb.load_dataset('tips')
Here we have imported tips dataset from seaborn library.
Now our dataset is ready.
Here we simply used boxplot to plot total_bill.
Once we run the above code snippet, we will see:
Scroll down to the ipython file to look at the results.
We can see box plot for total bill.