WEBVTT

00:00.920 --> 00:07.590
In the last video we have created a histogram for our each column and we did this with the panda's method

00:07.590 --> 00:16.160
to adopt plot where we pass the Hist to the parameter kind so we can see this and not only for histogram

00:16.190 --> 00:18.040
but also for other plot types.

00:18.050 --> 00:24.380
There is more than one way to plot data not data frame and in this video I will show you two other ways

00:24.410 --> 00:31.070
how to create here the same histogram and we will see that there are slightly differences and the pros

00:31.070 --> 00:32.870
and cons for each way.

00:33.140 --> 00:38.430
So in my opinion there is no optimal solution but let's have a look now.

00:38.510 --> 00:44.350
So the second alternative would be to use the direct method the shortest.

00:44.540 --> 00:51.020
So instead of having the other method plot and re pass hist to the perimeter there is also a direct

00:51.020 --> 00:58.300
method called hist and also here we can define the fixed size twelve eight and let's have a look here.

00:58.310 --> 01:03.560
So here we have some different parameter us in the documentation.

01:03.620 --> 01:08.550
So here you have explicitly the bins parameter and by default it sets of 10.

01:08.550 --> 01:10.720
But he said it to 80.

01:11.510 --> 01:17.080
And we can also set the X label size and the Y label size here.

01:17.120 --> 01:20.650
So we set it to 15 and we can see that.

01:20.710 --> 01:23.690
This is the last line difference here to the plot method.

01:23.960 --> 01:30.980
Slowly in the plot method we can actually determine the x level size and violated the size with the

01:31.010 --> 01:40.300
font size parameter and we've also seen this the direct plot method that there is no explicit have been

01:40.300 --> 01:41.690
parameter here.

01:41.710 --> 01:48.190
So here we do not see the bins parameter but if he passes his to the kind parameter then we can nevertheless

01:48.190 --> 01:50.010
see a use of the bins per meter.

01:50.170 --> 01:55.750
Even if it's not explicitly listed here all right.

01:55.810 --> 02:03.940
So now we come running our cell and we actually create the very same histogram so we FBA the same amount

02:03.940 --> 02:04.670
of bins.

02:04.690 --> 02:12.700
Then the same size of the labels here and we can see here by default the tier with the plot method we

02:12.700 --> 02:15.640
have here at the Y label frequency.

02:15.640 --> 02:17.670
And here we do not have the VI label.

02:17.680 --> 02:24.190
So this is a minor the friends and all let's go to the third alternative where we use them the Hist

02:24.190 --> 02:31.750
method directly on Mad plot flipped up type plots or purity not hist and we have to pass then the sequence

02:31.900 --> 02:34.390
from it so we want to have the histogram.

02:34.390 --> 02:41.080
So here in this case that we want to have the pen series the Titanic not age and also here we can set

02:41.380 --> 02:45.670
the bins parameter to 80 and let's try to run here.

02:45.720 --> 02:49.180
So and again error message.

02:49.180 --> 02:56.380
And in the end it's because the direct met plot Lapis method cannot by default handle here are missing

02:56.380 --> 02:56.950
values.

02:57.220 --> 03:04.740
So yeah our H column was missing values and if you pass the hour each column to the direct mat properly

03:04.860 --> 03:06.430
the method tests the.

03:06.460 --> 03:08.660
Then we have a problem.

03:08.710 --> 03:14.690
So before we can plot here our H column we have to drop them the missing values and we can do this with

03:14.710 --> 03:16.320
the method the drop and a.

03:16.360 --> 03:19.920
So we will have a closer look at later in this class on this here.

03:19.990 --> 03:21.470
So drop an A.

03:22.870 --> 03:28.540
And by doing so we are dropping all missing or add a values and now actually our code should work.

03:28.540 --> 03:30.710
So let's try this out here.

03:30.790 --> 03:38.530
So this looks quite similar to the other graphs like this the Rams and let's have a look here at the

03:38.530 --> 03:44.300
additional pair meet us and we can see here that here we have some more parameters.

03:44.440 --> 03:51.250
So for example we have the density meter and by default it set to false but we can also set this to

03:51.250 --> 03:59.020
true and then instead of getting here the absolute quantity for all of the beans here we get the relative

03:59.020 --> 03:59.680
quantity.

03:59.680 --> 04:01.120
So let's try this out here

04:03.880 --> 04:10.000
so here we have the relative quantity for all beans and we can also transforming our histogram into

04:10.000 --> 04:12.090
a cumulative histogram.

04:12.160 --> 04:19.960
So by passing here true to the parameter accumulated and here we are actually adding up all beans starting

04:19.960 --> 04:21.600
from the left hand side.

04:21.670 --> 04:26.830
So in the very end here we end up with the 1 0 100 percent.

04:26.830 --> 04:34.060
So still I feel normalized quantities and in the end if you sum over all beans then we have 100 percent

04:34.100 --> 04:35.800
of the data here included.

04:35.830 --> 04:43.270
So yeah we are ending at the 100 percent or 1 and actually in the other 2 direct Pena's methods that

04:43.300 --> 04:50.400
are explicitly know apparently does density and accumulative but still we can use them.

04:50.410 --> 04:53.320
So that several look here.

04:53.320 --> 04:59.340
So here we do not see any density are cumulative but still we can use these parameters here.

04:59.350 --> 05:00.220
So let's try.

05:00.250 --> 05:02.050
The cumulative parameter.

05:03.870 --> 05:05.310
And let's set it to true.

05:06.580 --> 05:15.880
And we get the absolute accumulated histogram so starting from zero here at the left hand side to over

05:15.880 --> 05:24.070
700 peasant just at the in total at the very end and also here for our plot method for example we can

05:24.280 --> 05:26.850
determine the parameter density

05:30.630 --> 05:32.640
and we can set it to true.

05:32.760 --> 05:38.600
And now we should get on the left hand side and set off absolute quantities the relative quantities.

05:38.730 --> 05:40.780
And this is true here.

05:40.830 --> 05:48.050
So actually the direct Panda's methods have the advantage that by default they can handle missing values

05:48.510 --> 05:52.760
but if we have a look at the pyramid us not all pyramid does that.

05:52.830 --> 06:00.510
The direct aim at plot lib method provides explicitly here listed in the parameters and if you do not

06:00.510 --> 06:02.780
know that these parameters exists.

06:02.910 --> 06:06.500
So then you could get the limited here and the functionalities.

06:07.050 --> 06:15.060
So in the end it's best to at least know all three alternatives and no all parameters that you can actually

06:15.060 --> 06:15.770
use.

06:15.930 --> 06:23.100
And then in the end it's actually a matter of taste which one of these alternatives you use all right.

06:23.100 --> 06:27.440
With this we are finished here and I hope to see you also in the next video by.
