And the last video we have seen how we can do scrapie and we have combined some countries in one table
like India, Pakistan and US population.
So in this video, we will do the second part.
So let me show you the website again.
So here you can see we have a different countries population.
Right.
So, for example, if I click China and then I need to know that different like cities, the population
of the cities, and now the requirement is we need to go to each country and then we have to count the
average population in that country according to the city.
So we will take the average of all the population of all the cities, and then we will display that
average in front of the country.
Right.
So let's do it step by step.
So for this, we need to copy the China population link and then go to the power grid.
Ed, here we have to click and nuclearised and web and let me paste the link and click.
OK, so here we have to choose the table six.
Because it contains all the cities for the selected country, this is China, so I need to click and
then I click, OK, we are interested in population, so we need to make a list of population.
So all we will do, how we how we can make the list out of the table.
So for this, we need to click the effects.
And here we have to right Beckett and the name of the column that is population.
They sit and click control.
So this is a list that contain the population for the selected country.
So I need now the average.
So how will the average?
Because this is a list.
So then we have to use a function in the list that is list dot average.
It started.
And we need to close it and then we have to conform.
So this is the average population policy.
Let's go to The View and what are they advanced, Ed?
So we need to write a function that will take the curious thing, like here is China.
And if I are right here, like India
and then we have done so here, you can see it is one seventy two point seven to nine seven two three.
So we need to write a function, go to the advanced editor, and here we have to write one function
here.
Just like put it in the prior video, so it is like a country name as text and what we have to return
as no.
And then the last line there said.
And we have a clip.
OK, so we need to use the country name parameter here.
We don't need to write this thing manually every time this part.
So it will be
and sign based and.
So that's it.
We need to click then.
So now we can right here first Bill right here, China Desh population in work, and here you can see
the population of China and the same way like if I do
use
and click confirm.
So this is the population of the US, right.
So the function is ready and now we need to make a table that will contain all the curious things so
that we don't need to write everything manually.
So how we will create that table for this?
I need to again go to the will go to this website and this time I need to take this in the population
by country so that I can get all the countries here.
So copy.
And then we have to go to the backslapping data and nuclear free web.
And control take control because our function is ready and now we need to prepare one table that will
have all the parameters that we were passing manually.
So we will prepare a table that will contain all those things possible to table one.
So this table contain the countryside.
So this is a quiet table.
We're just going to click.
Yes.
And click on.
So we are interested in this column.
So we need to right click and remove other columns.
And here if you look here, you can see the India or the United States or there is US population in
the adult population.
So we need to create a new column here.
Ed column, and then I write custom column, and here I have to write here, for example, countries,
countries link.
This is the column name.
And here, the first thing we need if the if there is any space like the United States or any country,
the United Kingdom, and we have seen most of the time, if there is a space, they have replaced the
space with our Desh.
Here you can see the first letter of every country is capital.
So we need to make everything smart.
So how we can do this.
There is a function called text, not law, and
we have to close it, right.
And then we have to right here one more function like replace.
We need to put some space here and then so that the Intellisense work, so to replace or not replace
text, so it will take a couple of images the first time, which is the original strain here.
The second parameter is the oldest text, that which text we want to replace.
So this is the space and the third parameter will be the dash.
So this is one thing.
So now we have spaces.
We have to ask if there is any space in the country name and all the letters will be small and then
we have to write one more Angelyne.
And Desh, like the entire population of our and here you can see.
And a population smaller, so it will be in certain space, it will be Dash.
So that's it.
So now we need to click, OK?
So here you can see this is the new column that contain country like China, population, India, population,
and if you see foreigners, Saudi Arabia, so Saudi Arabia.
So you can see if there is a space.
So we have dash instead of space.
Right.
So we need to do so because we are interested in this column controlling.
So we need to remove this column because we don't need it and remove it.
And here you can see the country.
So we need to just delete this involved function.
This is a function that is returning us the average value.
So here you can see a city like a city average.
So this is the name of the function.
And here the table name is countries.
This is the name of the cable that contain all the parameters.
So now we need to run this function for every role.
Right.
So this city average will run for this one, this one.
This one.
And then it will fetch the value for every role.
Right.
So for this, we need to click here the invoke function and column.
And here is the invoked custom function.
So we need to click here and here, you can write like a country country name and.
Then we need to choose the functionality.
So this is a function, ethnicity average and they the table opted this is the table like controlling.
So we have to choose the column for that table and then we have to click, OK?
Before clicking, OK, because it's a very, very big table is contained like two thirty five rows and
it will take a lot of time.
So we need to limit like we we we can write maximum like ten records for this demo because what we don't
need to wait like three or four minutes depending on the speed of your Internet and your computer.
So for this, I need to we have to write here one more function.
Here is a table dot first.
And so,
like we are interested in 50 percent, all 15 countries, the first 15 countries.
And then we we have to click here, confirm we we need to click on from here.
You can see we got 15 countries.
So now we need to click the invoked function and here we have to write the name of the column.
So countries, countries name and then they function.
Query is ethnicity average.
This is the name of the column controlling.
And then we have to click, OK, we got this result.
So here you can see we are getting the average population positive for each country.
So you have seen here.
We caught the error message in the United States population.
The reason is if you go to the if we go to the website and the United States, if you move forward,
the United States will see it is US Desh population, but in indeed poverty.
Ed, here, the name of the curious thing is the United States population.
That's why we are getting this error message.
If you see here, if you click here and you will see the link Valdo meter dot info and then the United
States population.
So you are unable to read it because this link does not exist.
So that's why you are getting the fourth quarter for error.
So you can change or you can just replace.
If there is a you if there is a United State, then it should then then it should be replaced with yesterday's
population.
So you have seen how easy it is to do the web scrapping with the help of poverty.