As told in the teary lecture, we need to change the non numerical values that base our categorical
variables into numerical values.
We will do that by creating dummy variables.
Creating dummy variables in Python is very easy.
Remember, we have two variables that are categorical.
The first one is airport, which has two categories.
Either yes or no.
And the other one is the waterboarding.
We test for categories Lake, River, Lake and River, and then.
So let's create dummy variables, and Biton
will right be difficult to.
Bebe not got dummies Guide Dummies is a function of Banda's.
That's why we are writing.
We don't get dummies.
And the record will mention or Dataplan.
That is D.F..
If you'd done this.
What a dummy variable, the seven all created.
Let's have a look at our data.
Where do they go first, by values, by using head function?
You can see if you scroll to the right.
For airport, we now have two columns, one.
We're airport variable values.
Yes.
And another one where airport variables had values.
No.
If you see a leer everywhere where airport.
It was yes.
Now we have one.
An airport, the US column and everywhere we are, the airport really was.
No.
We have one in airport, no volume.
Similarly, if you look at the waterboardings novia for numerical variables for for robotic categorical
variable similar to airport variable water body.
Is also divided in a similar fashion.
So wherever the water body was, lake, now we have one in water, body under school, lake variable.
Wherever the water body was, the river, we have one in the water.
What?
They were variable.
But if you remember, we told you that the number of dummy variable should be one less than the number
of categories.
The reasoning behind that is.
Let's take example of airport.
So if the airport value is yes, we have one end of the airport value is is no, we have zero in the
airport, the US column.
So in a way, this single variable is conveying all the information that we had in our airport variable.
There is no need of airport, no variable.
We are going to see that this kind of relationship.
We call it full negative correlation.
So everywhere the value of airport noise, zero, we have one in their 40s value.
And everywhere.
The airport, well, you know, is one we have zero in the airport.
Yes.
Value.
So both of these variables are conveying the same information.
That's right.
We are going to delete one of this variable.
Similarly, we are also going to delete what underscore non variable sense if we have zero in all the
three variables of our body, that is water over the lake, waterboarding river and water will be Lake
Underscore River.
This means that there should be one in water body none.
So again, waterboarding none.
Here is a redundant variable and we will delete that also.
So let's delete these two variables.
Some Texas then.
If and then the squared record will mention airport underscored not.
Next, let's believe waterboarding.
Underscoring then.
Remember that and its capital and waterboarding then.
And by Biton, this case sensitive language.
Let's look at the beef.
You can see now we have only one variable for the airport, and that is airport.
And the one where you represent that airport is present and zero and you represent that airport is not
present.
Similarly, we have three separate variables for water, body and presence of number one, represent
that that water what is present near the city.