3.7 STANDARDIZING THE NUMERIC FIELDS
Certain algorithms perform better when the numeric fields are standardized so that the field mean equals 0 and the field standard deviation equals 1,6 as follows:
![equation](https://static.packt-cdn.com/products/9781119526810/graphics/images/c3-disp-0001.png)
Positive z‐values may be interpreted as representing the number of standard deviations above the mean the data value lies, while negative z‐values represent the number of standard deviations below the mean. Some analysts standardize all their numeric fields as a matter of course. Next, we show how to standardize numeric fields in Python and R.
3.7.1 How to Standardize Numeric Fields Using Python
Import the required package.
from scipy import stats
We will standardize the age variable and save it as a new variable, age_z.
bank_train['age_z'] = stats.zscore(bank_train['age'])
The zscore function calculates the z‐value of the given variable, in this case...