## Introduction

In this tutorial, we want to** **create a **Boxplot**. In order to do this, we use the **boxplot()** function of **Seaborn**.

## Import Libraries

First, we import the following python modules**:**

```
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
```

## Define Data

Let's define our **example data**. We consider the exam results of a university class. The number of points ranges from 0 to 100. We consider a class with 20 students that took part in five exams.

```
exam_result = np.random.randint(100, size=(20,5))
print(exam_result)
```

**Create DataFrame**

Now, we would like to store our generated data in a **DataFrame**:

```
df = pd.DataFrame(exam_result, columns=['Machine Learning',
'Statistics',
'Computer Science',
'Neural Networks',
'Economics'])
print(df)
```

**Plot Boxplot**

Next, we would like to visualize the exam results with a **boxplot**. In order to do this, we use the **boxplot() function** of **Seaborn**.

```
#Set figure size
f = plt.figure()
f.set_figwidth(12)
f.set_figheight(8)
# plotting the boxplot
boxplot = sns.boxplot(data = df)
# displaying the boxplot
plt.xlabel("Exam")
plt.ylabel("Points")
plt.tight_layout()
plt.show()
```

## Conclusion

Congratulations! Now you are one step closer to become an **AI Expert**. You have seen that it is very easy to create a **Boxplot**. We can simply use the **boxplot()** function of **Seaborn**. Try it yourself!

Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.