<jupyter_start><jupyter_text>The Box Plot.There are many explainations about Box plot the below mentioned is the most I like. It is short, crisp and to the point.A Box Plot is the visual representation of the *statistical five number summary* of a given data set.A Five Number Summary includes:1. Minimum2. First Quartile3. Median (Second Quartile)4. Third Quartile5. MaximumThe Box plots are also known as *“Box and Whisker Plot”*. **<NAME>**, A Mathematician Introduced “Box and Whisker Plot” in 1969 as part of his toolkit for exploratory data analysis (Tukey, 1970), but it did not become widely known until formal publication (Tukey, 1977). The basic graphic form of the boxplot, the range-bar, was established in the early 1950’s Spear (1952, pg.164).  “Box plots use robust summary statistics that are always located at actual data points, are quickly computable (originally by hand), and have no tuning parameters. They are particularly useful for comparing distributions across groups.” said *<NAME>*.Reference:![](https://github.com/cdigap/FDA_Project/blob/master/box_Det.png?raw=true "Box Plot")Let me try to explain *what's in the box ?*The boxplot is made up of five components, carefully chosen to give a robust summary of the distributionof a dataset:* The median,* Two hinges, the upper and lower fourths (quartiles),* The data values adjacent to the upper and lower fences, which lie 1.5 times the inter-fourth range from the median,* Two whiskers that connect the hinges to the fences, and* (potential) out-liers, individual points further away from the median than the extremes.<jupyter_code>import numpy as np
import pandas as pd 

from pandas.plotting import scatter_matrix

import matplotlib.pyplot as plt

import seaborn as sns

%matplotlib inline

#Assigning the data File to dfile
  
dfile = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"

colms = ['Sepal_Length','Sepal_Width','Petal_Length','Petal_Width','Species']

# data File getting the Headers assigned.
data_file = pd.read_csv(dfile,names=colms,index_col='Species')

# Details of each columns identified being generated and displayed.
data_file.info()
data_file.head(10)
data_file.describe()
plt.figure(figsize = (10, 8))
data_file.boxplot()
data_file.plot(kind='box', subplots = True, layout = (1,4), sharex = False, sharey = False, title='Summary Box Plot', figsize = (10, 8))
plt.figure(figsize = (10, 8))
data_file.boxplot(column=['Sepal_Length'], by='Species', figsize = (10, 8))<jupyter_output><empty_output><jupyter_text>As we can see with the above examples of box charts we can picturize the data in a better way to understand better. Let us now understand terms quartile and percentile. Quartile: To understand Quartile lets understand Quantile. Quantile : The cut points dividing the range of probability distribution into continuous intervals with equal probability There are q-1 of q quantiles one of each k satisfying 0 < k < q  Quartile : Quartile is a special case of quantile, quartiles cut the data set into four equal parts i.e. q=4 for quantiles so we have First quartile Q1, second quartile Q2(Median) and third quartile Q3<jupyter_code>#finding out Quantile
data_file.Sepal_Length.quantile([0.25,0.5,0.75])<jupyter_output><empty_output><jupyter_text>Percentile: Is a measure used in statistics indicating the value below which a given percentage of observations in a group of observations fall.Example: the 20th percentile of X is the value QX(0.20)<jupyter_code>#Finding out Percentile
np.percentile(data_file.Sepal_Length, 25)  # Q1

np.percentile(data_file.Sepal_Length, 50)  # median

np.percentile(data_file.Sepal_Length, 75)  # Q3

#With Describe function we are get all the information in one command.

data_file.Sepal_Length.describe()<jupyter_output><empty_output><jupyter_text>Box Plots and Alternatives BoxenA related function, boxenplot(), draws a plot that is similar to a box plot but optimized for showing more information about the shape of the distribution. It is best suited for larger datasets:<jupyter_code># creating a subset of data to show as examples.

c_IS = data_file.loc['Iris-setosa']


g = sns.catplot(kind="boxen",  data=c_IS)

g.set_titles("Summary Boxen Plot - Iris-setosa")

c_IS.plot(kind='box',  title='Summary Box Plot - Iris-setosa')<jupyter_output><empty_output><jupyter_text>ViolinplotsAn alternative to the boxplot is the violin plot (sometimes known as a beanplot), where the shape (of the density of points) is drawn.A different approach is a violinplot(), which combines a boxplot with the kernel density estimation procedure described in the distributions.<jupyter_code>#fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(12,4))

sns.catplot(kind="violin", data=c_IS)

c_IS.plot(kind='box',  title='Summary Box Plot - Iris-setosa')<jupyter_output>C:\Users\ashok_p_g\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\stats\stats.py:1633: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
StarcoderdataJupyterStructuredCleanDedup