WEBVTT

00:02.550 --> 00:06.210
In this video we learn how to use them the methods any and all.

00:06.240 --> 00:08.310
But first of all let's impart pandas.

00:08.340 --> 00:15.970
And we use our Titanic's data frame and then we create a boolean series.

00:15.960 --> 00:21.640
I would check for each row of whether the peasant says a male here.

00:21.640 --> 00:24.190
So we create a boolean serious nothing new.

00:25.000 --> 00:25.540
So now what.

00:25.540 --> 00:28.290
If you want to check if at least one passenger is a male.

00:28.290 --> 00:33.120
So we have at least the one true here in our panda series.

00:33.250 --> 00:36.990
And for this task we can use the any method.

00:37.060 --> 00:45.730
So we have our panda serious and we have to use your brackets and then use the any method and let's

00:45.730 --> 00:55.310
check here the any method return whether any element is true or whether you requested X's so we get

00:55.310 --> 00:55.960
it through here.

00:55.970 --> 01:00.320
If any of the elements in our series here is true.

01:01.010 --> 01:02.910
So let's check this out.

01:03.140 --> 01:05.210
And of course we got a true here.

01:05.210 --> 01:08.410
So we actually know that on the Titanic there were many males.

01:08.450 --> 01:14.870
And with the all method we can check whether all passengers were made.

01:15.680 --> 01:24.250
So we do check here if in our pandas serious All values are true as AND UH LET'S CHECK you're also with

01:24.260 --> 01:33.300
Chef tab return whether all elements are true so we actually know that there were many females and males

01:33.330 --> 01:34.400
and uh.

01:34.470 --> 01:36.290
So not all passengers are males.

01:36.300 --> 01:45.360
So we should get a false and that's true so our male example was quite obvious and we could have answered

01:45.450 --> 01:52.830
the questions here by just having look here at the panda series however let's try a less obvious case

01:52.890 --> 02:01.860
and let's check whether at least one passenger is exactly 80 years old so we create here a panel serious

02:01.860 --> 02:06.960
and checked whether the peasants sounds like exactly 80 years out and then we check with the any method

02:07.950 --> 02:09.730
if we get at least the one true.

02:11.710 --> 02:19.250
And this is the case so from early videos we know that um the oldest passenger on board was exactly

02:19.250 --> 02:27.970
80 years old and we can use in the any end all method not only for boolean serious but also for serious

02:27.980 --> 02:30.570
with numerical values.

02:31.040 --> 02:37.280
So we might know that the bringing value to a stands not only for the integer 1 but for all numbers

02:37.280 --> 02:41.720
that are not equal to zero and the Boolean value for instance far.

02:41.720 --> 02:42.570
Exactly.

02:42.680 --> 02:45.790
And only zero.

02:45.800 --> 02:54.200
So now let's create here a panda series with the elements minus 1 0 point 5 for 1 minus open 1 and 0

02:55.630 --> 03:02.740
and with the all method we check if all elements in our pandas serious act rate are less than zero.

03:02.740 --> 03:10.080
So if they are not equal to zero and we can see here that we have a zero so we should get you a false

03:12.160 --> 03:20.440
and with the any method we can check if we have at least the one element in our panda serious that is

03:20.500 --> 03:21.910
and equal to zero.

03:21.910 --> 03:30.550
And here we should get a true and now last but not least let's check our Fifth Column if all passengers

03:30.550 --> 03:34.240
paid a price that is greater than then zero.

03:34.270 --> 03:40.190
So if you only have one passenger that paid nothing actually for the ticket then we should get here

03:40.210 --> 03:49.110
a false and this is the case or from earlier videos we know that there were some passengers that actually

03:49.110 --> 03:57.370
it didn't pay anything for their ticket so we have some zero values in our fair column and therefore

03:57.600 --> 04:02.230
by using the all method we get here a false.

04:02.230 --> 04:07.360
All right so now we are finished with this video and I hope to see you in the next one by.
