WEBVTT

00:01.000 --> 00:02.120
Hi everybody.

00:02.140 --> 00:08.200
In this video we analyze the pen that serious with non American value is so flexible String objects

00:08.380 --> 00:13.820
like names and therefore we work with the Summer Olympics data set.

00:13.990 --> 00:21.670
And first of all we import pandas and we import our Summer Olympic medal data set and we will have a

00:21.670 --> 00:30.400
look at the first five rows so you can see here each row is actually a medal that was awarded during

00:30.390 --> 00:31.840
a summer Olympic games.

00:32.110 --> 00:39.340
And here in the columns we have and the year of the Olympic Games and the host city the sport the discipline

00:39.880 --> 00:41.620
the athletes who won the medal.

00:41.620 --> 00:50.050
So here in this example if it hires won the gold medal and he's from Hungary and he's the man and the

00:50.050 --> 00:57.280
event was 100 meter freestyle and let's check also with the Inform method that we have in total thirty

00:57.280 --> 01:03.490
one thousand one hundred sixty five meters then that were awarded from eighteen hundred ninety six to

01:03.670 --> 01:13.250
2012 we have nine columns and we have more or less and no missing values only here in the country column

01:13.250 --> 01:20.780
for missing values and our year column contains in the US and all of the other columns contain actually

01:20.780 --> 01:28.370
String objects and now starting from our data frame here we can create a panel serious with the non

01:28.370 --> 01:37.140
numerical values so for example we slice for the column athlete and we assign the column athlete to

01:37.160 --> 01:38.720
the variable athlete.

01:39.230 --> 01:48.000
So let's do this and first of all we can check and the type of our column here and it's the panda series

01:48.760 --> 01:54.700
and let's have a look at the first five elements are rows of our panda serious.

01:54.700 --> 01:56.860
So here we have them the values.

01:56.860 --> 02:00.180
These are the athletes on the right side and on the left side.

02:00.280 --> 02:07.390
We still have an index of our pandas data frame and we can also have a look at the last five rows

02:10.470 --> 02:17.520
and we can also check the data type of them the values for the now pandas serious so to be here mastering

02:17.900 --> 02:19.780
we have year 0 4 object.

02:19.830 --> 02:26.160
So in simple words then we have an oh here it's very likely to String objects actually and we can also

02:26.160 --> 02:33.120
check the shape of our panda serious and we have a one dimensional array so a panda seriousness always

02:33.120 --> 02:42.130
one dimensional and we can also try to use and the described method and the described method gifts that's

02:42.220 --> 02:46.530
actually different results compared to a numerical series.

02:46.680 --> 02:54.830
So here for non numerical series we get first of all the total count of elements so we have thirty one

02:54.830 --> 03:01.610
thousand one hundred sixty five athletes and twenty two thousand seven hundred sixty two we are actually

03:01.610 --> 03:02.110
unique.

03:02.120 --> 03:05.860
So we have many athletes that won more than one medal.

03:05.870 --> 03:12.140
So for example Michael Phelps who is actually the top athlete who won the most medals and it's year

03:12.140 --> 03:13.130
frequency.

03:13.160 --> 03:16.550
You can see Michael Phelps 122 medals.

03:16.820 --> 03:20.060
And we can also check here at the size of our pandas serious.

03:20.060 --> 03:28.020
That's thirty one thousand one hundred sixty five and with the current method you can also check for

03:28.020 --> 03:29.830
the amount of normal values.

03:29.850 --> 03:30.370
And.

03:30.420 --> 03:33.780
This will see the same as with the size as attribute.

03:34.140 --> 03:40.650
So in our athlete column or panel series we do not have any missing or any end values.

03:40.650 --> 03:46.620
So if we had any end values and then the count method here what does that return a lower value than

03:46.620 --> 03:47.910
our size attribute.

03:48.420 --> 03:55.320
And the difference would then be actually the amount of missing values and we can also try to apply

03:55.380 --> 04:02.850
the min method so far in the map numerical serious we get to hear the minimum element and it's a non

04:02.850 --> 04:09.210
numerical values we get here as a better clear the very first athlete and that's the guy.

04:09.360 --> 04:15.010
I don't know how to pronounce it here but it starts with a double A B so alphabetically.

04:15.030 --> 04:22.960
This athlete or sexually the very first athlete and we can also check our pandas serious for unique

04:22.960 --> 04:32.620
values so we are all unique uh values are to say um athletes that won a medal in some Olympic Games

04:33.250 --> 04:40.060
and we can also count the number of unique athletes with the lungs function is twenty two thousand seven

04:40.060 --> 04:44.360
hundred sixty two and we can do the same with the method.

04:44.470 --> 04:50.770
Any unique sort of awesome returns us yet twenty two thousand seven hundred sixty two

04:53.460 --> 04:54.890
and it's unique.

04:54.900 --> 04:59.590
We can decide whether we want to skip and missing on a values or not.

04:59.820 --> 05:04.250
And we do not have any missing values here and our athletes series.

05:04.260 --> 05:06.780
So the result should be the same actually.

05:07.760 --> 05:09.310
So a default value is.

05:09.420 --> 05:10.080
True.

05:11.100 --> 05:18.210
And if we change to force so we should also look at the twenty two thousand seven hundred sixty two

05:18.210 --> 05:20.770
because we do not have missing values.

05:21.050 --> 05:22.240
All right.

05:22.380 --> 05:25.910
And last but not least we can also use them here.

05:25.960 --> 05:27.880
Father No no not in America.

05:27.880 --> 05:31.320
I'm serious and the very powerful method value Collins

05:34.440 --> 05:40.300
and what value Council actually does it returns us a panda serious with me actually.

05:40.310 --> 05:45.070
The frequency of all values some that appear in our pandas series so.

05:45.460 --> 05:51.290
Here we can see Michael Phelps is 22 times in our athlete pandas serious them.

05:51.300 --> 05:59.040
That means that Michael Phelps 122 Olympic medals in his career and value counts by default returns

05:59.070 --> 05:59.860
us here.

05:59.880 --> 06:02.200
The frequency and sort of order.

06:02.480 --> 06:08.100
So actually in descending order so the value with the highest frequency comes first here and that's

06:08.100 --> 06:16.690
Michael Phelps and the second most successful athlete a seer laterals are Latina and so on here then

06:16.800 --> 06:23.810
we can scroll down and in the end we end up with the athletes that won one gold medal here.

06:25.690 --> 06:30.790
And with the ascending perimeter we can also change the order of sorting.

06:31.330 --> 06:39.010
So here now we are starting with the athletes that won one medal and in the end we have here also Michael

06:39.010 --> 06:39.550
Phelps

06:45.580 --> 06:54.070
and we can also normalize our results to the 30 normalize perimeter so the normalized perimeter does

06:54.070 --> 06:58.080
not return absolute frequencies but relative frequencies.

06:58.210 --> 07:07.450
So we have some 31000 about medals and Michael Phelps won yeah only 0 point 0 0 7 0 6 percent of all

07:07.450 --> 07:08.650
medals.

07:08.660 --> 07:13.700
All right now we are finished with this session and the next session we will see and learn how to create

07:13.720 --> 07:14.990
panic serious.

07:15.160 --> 07:16.840
So hope to see you there by.
