**Heads up!** To view this whole video, sign in with your Courses account or enroll in your free 7-day trial.
Sign In
Enroll

Preview

Start a free Courses trial

to watch this video

Make a histogram to find out the distribution of Attack Points. Then use a kernel density estimation plot to find the distribution of Defense Points as a probability curve.

#### Challenge

- What is the distribution of:
- Attack Points?
- Defense Points?

#### Solution

```
sns.histplot(data=monsters, x='Attack_Points', kde=True)
sns.kdeplot(data=monsters, x='Defense_Points', kde=True)
```

**Related Discussions**

Have questions about this video? Start a discussion with the community and Treehouse staff.

Sign up**Related Discussions**

Have questions about this video? Start a discussion with the community and Treehouse staff.

Sign up

In our last challenge,
we explored the relationship between two
0:00

quantitative variables,
level and attack points.
0:04

It would be nice to know the distribution
of some variables with the histogram and
0:09

a kernel density estimation.
0:13

So what is the distribution of
attack points and defense points?
0:16

Here's some hints,
use sns.histplot and sns.kdeplot.
0:21

Make a histogram to find out
the distribution of attack points.
0:29

You can also plot a kde curve over
the histogram by setting the kde keyword
0:33

argument to true.
0:38

Then use the kernel density estimation
plot to find the distribution of
0:39

defense points as a probability curve.
0:44

Pause me and try it out.
0:47

How did it go?
0:51

Here's how I solved these problems.
0:53

For the histogram sns.histplot,
0:55

(data = monsters,
1:07

x= 'Attack_Points',
1:10

and kde = True).
1:15

Nice, for our histogram of attack
points it looks like most monsters
1:18

have attack points distributed
between 750 and 1500.
1:24

There are 10 observations between 750 and
1000 and
1:29

10 observations between 1250 and 1500.
1:35

That's about half of
the monsters in our collection.
1:40

Now for the defense points,
1:46

sns.histplot (data = monsters,
1:50

x = 'Defense_Points',
1:55

And kde = true).
2:04

Nice, for our defense points
distribution it looks like most
2:09

monsters have defense points
distributed between 1000 and
2:14

2000 with 10 observations at 1000 and
2:19

9 observations between 1500 and 2000.
2:24

Awesome work so far, analysts.
2:28

We're done with quantitative analysis.
2:30

In the next challenges,
2:34

we will move on to explore our
categorical variable attribute.
2:36

I'll catch you there.
2:41

You need to sign up for Treehouse in order to download course files.

Sign upYou need to sign up for Treehouse in order to set up Workspace

Sign up