In this video, we will learn about variable transformation.
As you can see in our dataset, we have four distance variables, these distance variables are giving
us the distance of the house from four different employment hubs.
Now keeping for distance variables in our dataset is over, representing the importance of the employment
variable.
We need to transform these four variables into one single distance variable, which can represent the
employment opportunity near that house.
There can be several ways to transform these four into one, either we can choose the minimum of the
distance or we can choose the maximum of these four distances, or we can just take an average of these
four distances.
Usually we have to take into account the business scenario in which we are to decide which transformation
matter we are going to use.
Here, I'll use the mean method, that is, I'll replace all these four variables by the mean of these
four variables.
Depending on your business scenario, you have to take the decision for your problem.
So I'll add a new variable.
To add a new I need a new column, so I write on the column name and I inserted a new column and I'm
naming it average based EVGA and this could be used.
Now, in this variable, I'll put the average value of the other four variables to this is average,
what these four variables render.
Now, to extend this formula for other cells, you can just double click on this bottom right corner
of the cell and this formula will be extended to other cells below the cell.
So this value of 4.0 aid is the average of these four distances, four point three five, three point
eight one or one minute and 4.0 one.
Similarly, the average distance in the next observation is the average of next for distant variables.
Now that we have the average distance variable, we do not need the other four distance variables,
so therefore we will be deleting those four distant variables.
But before we delete these four variables, we first need to change the value in this cell from this
formula to the actual value.
So we will select the values in all these cells.
Copied them by pressing control, see?
Then right, click on the cell and paste these values.
Now we have the exact same value in this cell, but instead of the formula, we have the value here.
Now, if I delete these four columns, it will not impact.
Devaluing the average tenth column to have selected those four columns and clicked on the lead option.
So this is how we identified variables which need transformation, we transform them into a new variable
and we deleted the old variables.