We can use the var() function from NumPy to calculate the variance (using the first data set with 10 observations).
| import numpy as np var = np.var(health_data) print(var) |
The output:

Here, we calculate the variance for each column in the full data set.
| import numpy as np var_full = np.var(full_health_data) print(var_full) |
The output:
