WEBVTT

00:01.320 --> 00:06.820
All right in this video we will learn how to create a histogram For our Titanic age column.

00:06.820 --> 00:13.170
So histogram says specifically useful to visualize the frequency distributions of values in the marriage

00:13.210 --> 00:14.420
columns.

00:14.620 --> 00:19.860
So fiscal 5 import pandas and we are also importing a map plot flip.

00:19.900 --> 00:21.070
S p a t.

00:21.070 --> 00:23.650
And we use the Seabourn style.

00:24.130 --> 00:32.520
And we are importing our Titanic dataset and before we also land that we can analyze the frequency of

00:32.520 --> 00:36.170
fair use with the value counts method.

00:36.180 --> 00:42.170
So here we are selecting the H column and we are analyzing the H column with the value counts method

00:44.230 --> 00:48.410
and the most frequent values actually at 24.

00:48.640 --> 00:56.350
So 30 passengers are twenty four years old and here at the end we have some outliers low point for two

00:56.350 --> 01:05.680
years for example and we can also organize our ages here in bins and let's have a look here so that

01:05.680 --> 01:08.960
I see the barometer bins and by default it set to None.

01:10.910 --> 01:17.480
But we can also set the bins to true and then rather than count better use bins that group them in two

01:17.480 --> 01:18.690
bins.

01:18.830 --> 01:21.740
So for example now let's set the bins to 10.

01:21.740 --> 01:24.510
So they're creating 10 bins.

01:24.510 --> 01:32.210
All right an S is missing years out of work and here we have ten equal width bins.

01:32.210 --> 01:40.840
So starting here from zero to eight then eight to 16 and so on and the bin are the in Taba.

01:40.880 --> 01:43.040
This the the most value use year.

01:43.040 --> 01:46.100
Actually the interval between 16 and 24.

01:46.520 --> 01:49.480
So here we have one hundred seventy seven passengers.

01:50.330 --> 01:57.980
And the least frequent business here between 72 and 80 of us only two passengers and the same we can

01:57.980 --> 02:01.780
actually do graphically with a histogram.

02:01.970 --> 02:08.240
So we are selecting here the H column and then we're using the plot method and the.

02:08.270 --> 02:09.860
So let's run the FSA far.

02:10.520 --> 02:18.560
So here we have our line plot and instead of passing lines or line plots actually here to Fort value

02:19.130 --> 02:27.600
and instead of passing line to the perimeter kind we can also pass a hist for histogram.

02:28.020 --> 02:30.570
And here we have the histogram.

02:30.570 --> 02:36.030
And by default we have 10 bins and these are actually the same bins says here above.

02:36.030 --> 02:43.680
So from zero today to then from eight to 16 and so on and the very last bin this farm seventy two to

02:43.770 --> 02:51.770
80 90 and this spend we have only two passengers and the largest our most frequent bin is actually a

02:51.840 --> 03:01.320
this bin and this is on the Internet 16 to 24 so having here 10 bins is actually the default setting

03:01.650 --> 03:05.710
but we can also change the amount of bins and the.

03:05.860 --> 03:08.420
There is here the parameter bins.

03:08.410 --> 03:16.200
However if you have here a look with this if tab then the parameter bins is not explicitly displayed

03:16.200 --> 03:21.240
here and this is actually a disadvantage if you see the plot method.

03:21.450 --> 03:27.990
So some specific parameters which are only available for some specific plot types of example here that

03:28.080 --> 03:36.060
inspire me to find the histogram are actually not listed here in the plot method however at least in

03:36.060 --> 03:39.780
this case for the bins parameter we can still use it here.

03:40.200 --> 03:48.750
So let's simply call here the bins parameter and for example let's assume we want to have uh 30 bins.

03:48.750 --> 03:49.790
That's roughly the same.

03:50.190 --> 03:57.300
And then we can see here that we have 30 separate bins and so if you get a range between 0 and 80 it

03:57.300 --> 03:59.640
could also make sense to FBA 80 bins.

04:00.210 --> 04:03.030
So for each year we have one bin.

04:03.840 --> 04:10.200
So for example here we have one 80 year old passenger and here a lot of spin and sexually I think it's

04:10.380 --> 04:12.040
24.

04:12.050 --> 04:18.690
All right so now we have seen that the plot method is actually not the optimal solution if we FBA other

04:18.690 --> 04:27.060
kinds than airline plots and in the next video we will also learn some other alternatives how to create

04:27.060 --> 04:28.380
here the histogram.

04:28.770 --> 04:31.980
But for the time being we are not finished and I hope to see you.

04:31.980 --> 04:33.450
And then next video by.
