WEBVTT

00:00.730 --> 00:05.670
Welcome to the solution for coding exercise to and and Question 7.

00:05.670 --> 00:10.430
We are asked to import pandas and as always we import pandas Expedia.

00:10.710 --> 00:13.910
Then we should import the listings dataset.

00:14.130 --> 00:21.180
And of course we pass the listings of the CSP file name to the agreed CSB method.

00:21.660 --> 00:25.150
And finally it is always a good idea to inspect.

00:25.170 --> 00:32.230
The first 5 or 10 rows and we can do the service to the head method and then we should select the the

00:32.230 --> 00:38.470
column name with the attribute notation and the question is what is so the company name with index label

00:38.470 --> 00:39.360
4.

00:39.400 --> 00:43.580
So we are coding your listings start name and let's have a look.

00:43.600 --> 00:50.800
So that's in the name column and at the index label for we have here American Airlines Group.

00:50.800 --> 00:52.450
So that's correct.

00:52.510 --> 00:59.140
And uh the next question is apply also the second alternative to select the column name and we can do

00:59.140 --> 01:01.540
this with scrap records and half.

01:01.550 --> 01:08.820
Yeah the column label name so that's identical actually.

01:08.850 --> 01:14.630
Next we have to select the listing our row at the next position 100 with the ILO operator.

01:14.670 --> 01:17.350
So that's a position based indexing.

01:17.580 --> 01:25.050
And the question is what is the IPO year of that the respective listing service U.S.A. The ILO operator

01:25.080 --> 01:26.820
and we pass the 100

01:30.860 --> 01:37.470
and the IPO year of this respective listing is two thousand and fourteen.

01:37.540 --> 01:41.590
Here we have to select the listing all the row at index position 2000.

01:41.710 --> 01:46.970
Again with the ILO operator and we only have to select the column name.

01:47.080 --> 01:48.460
So this is position based.

01:48.460 --> 01:52.240
The next thing and the zero best and next thing applies also here.

01:52.240 --> 01:56.330
So we have to determine at which index position we have.

01:56.350 --> 01:58.150
Uh the column name.

01:58.300 --> 02:01.960
So let's have a look here at the beginning.

02:01.970 --> 02:07.610
So we have here the column name and the column is that the next position is 0 1 2

02:12.750 --> 02:19.120
and therefore we pass the other row and next position 2000 and the column and next position 2.

02:19.170 --> 02:22.560
And the question is about us the company name of this listing.

02:22.590 --> 02:25.430
So let's have a look and it's Eagle Bancorp.

02:26.040 --> 02:28.500
So let's go to the next question.

02:28.500 --> 02:35.640
Select the last 10 rows and the columns name last price sector and industry with the ILO operator.

02:35.640 --> 02:44.430
So still this is a position based indexing and the last 10 rows means from index position minus 10 to

02:44.460 --> 02:46.130
the very last row.

02:46.680 --> 02:52.430
And the for the columns we offer a list with the indexed positions 2 4.

02:52.440 --> 02:59.040
The name column then 3 7 and 8 for the columns the last price sector and industry.

02:59.040 --> 03:00.640
So you can check this.

03:01.110 --> 03:04.770
And the question is here what is the the sector of these same works.

03:04.780 --> 03:10.450
A company and a civil look here.

03:10.510 --> 03:18.510
Here we have signed works and the sector is healthcare here we have to report the listening state asset

03:18.960 --> 03:23.010
and that we have to set the column symbol s the index.

03:23.110 --> 03:24.380
And again here we can do this.

03:24.410 --> 03:27.960
The city agreed CSB method and b pass of the file name.

03:28.090 --> 03:34.600
And then we pass the the column Labor symbol to the index called the parameter and we save the data

03:34.600 --> 03:38.520
frame again in the variable listings so let's have a look here.

03:39.490 --> 03:41.260
Here we have on the left hand side.

03:41.290 --> 03:45.270
The former column symbol as the index of the data frame.

03:45.670 --> 03:49.930
And also we can check this with the info method.

03:50.020 --> 03:56.170
Here we have in the index six thousand eight hundred fifty two entries from a to z y x.

03:56.270 --> 03:56.880
I.

03:57.610 --> 03:59.170
And the next question is.

03:59.170 --> 04:03.070
Inspect the new and next left the data frame by calling the index attribute.

04:03.070 --> 04:04.510
So that's an easy one here.

04:06.330 --> 04:11.330
So here we have all stock tickers from a onto a set y x eye.

04:11.880 --> 04:15.480
Then the next question select the row with the index label.

04:15.480 --> 04:22.350
Apple AAPL and this is obviously a label based indexing with the loke operator.

04:22.890 --> 04:30.460
So we pass uh the stock ticker AAPL to the local operator within square brackets here.

04:30.600 --> 04:36.790
And the question is what is the last price and the last price of the Apple stock.

04:36.820 --> 04:37.230
Yes.

04:37.270 --> 04:40.290
Uh two hundred point six two.

04:40.410 --> 04:47.060
Then we have to select the row with the index label FP for Facebook and only the columns IPO year and

04:47.120 --> 04:48.290
industry.

04:48.470 --> 04:54.590
And again we are using here the local operator we have label based indexing and on the left hand side

04:54.590 --> 05:02.180
of the comma we pass the arrow label FP and on the right hand side a list with the column labels IPO

05:02.180 --> 05:03.960
year and industry.

05:04.010 --> 05:05.810
So let's have a look here.

05:05.840 --> 05:12.830
The question is what is the industry of Facebook and the industry is obviously computer software programming

05:12.830 --> 05:21.230
and data processing and the next question we have to select the columns and name and last price with

05:21.290 --> 05:23.980
the local operator and all rows.

05:24.080 --> 05:30.020
So we use a colon for all rows and then again here a list with the column labels

05:34.240 --> 05:40.570
and the final question select the last three columns IPO year sector and industry for Microsoft and

05:40.570 --> 05:48.310
Disney and we have to do this with the local operator and we shouldn't use the sector or industry in

05:48.310 --> 05:49.490
our code.

05:49.510 --> 05:54.960
So first of all we are only interested in the Rose are the listings Microsoft and Disney.

05:55.540 --> 06:02.200
And we pass here the list with those two stock takers and then we should select the last three columns

06:02.290 --> 06:10.780
starting from IPO year then sector and industry and we can simply do this by passing the IPO year and

06:10.780 --> 06:15.640
colon on that means until the very last column inclusive.

06:15.640 --> 06:22.460
So let's run this out here and the question is What is this in this industry and this nice industry

06:22.460 --> 06:27.710
as television services so that's the solution for exercise too.

06:27.710 --> 06:30.620
And I hope to see you also in the next exercises by.
