Why is the display of summary statistics changed after normalizing data? [duplicate]

I posted this question on stackoverflow.com and have not received any answer. In case I get an answer from one of them, I will inform on the other.

I am using describe() to summarize data before and after normalizing data.

import pandas as pd
import urllib3
from sklearn import preprocessing

decathlon.describe()

nor_df = decathlon.copy()
nor_df.iloc[:, 0:10] = preprocessing.scale(decathlon.iloc[:, 0:10])
nor_df.describe()

At first, I have Then I have Could you please explain why the display is different? In the second one, the number is, for example, $$4.100000e+01$$.

I feel that this display makes it hard to check that the mean and variance of each column are 0 and 1 respectively.

• What difference in the display are you referring to? Oct 27 '20 at 9:17
• @jkpate In the second one, the number is, for example, $4.100000e+01$. Oct 27 '20 at 9:18
• Also see How to read scientific notation ... and many more on site. Oct 27 '20 at 9:39

The second display uses scientific notation. For example, the first count is reported as $$4.1 * 10^1 = 4.1 * 10 = 41$$. The original display did not use scientific notation because there are not many significant digits, while the second display uses scientific notation because, after standardization, there are many significant digits. See this question for approaches to control the use of scientific notation in Pandas displays.

Zero mean

The first mean is reported as $$-1.516402 * 10^{-16}$$, a tiny number that is very close to zero. It is not exactly zero because of floating point instability.

Unit variance

Similarly, the first standard deviation is $$1.012423 * 10^0 = 1.012423 * 1 = 1.012423$$, which is greater than one than you would expect. This is because Pandas describe() uses Pandas std(), which defaults to using Bessel's correction for sample variance. We can recover the the uncorrected variance by multiplying by $$\frac{N-1}{N}$$. For example, for the first standard deviation, the uncorrected variance is: \begin{align} \sigma & = \frac{40}{41} (1.012423 ** 2)\\ & = 1.0000003228575611 \end{align}

• I’ve got to think that as soon as the “mean” row uses scientific notation to get 16 decimal places, the whole chart goes to scientific notation.
– Dave
Oct 27 '20 at 9:36
• Honestly, I'm unable to understand why $1.012423$ is considered as close to $1$. Oct 27 '20 at 9:44
• I followed up with a deeper dive into the standard deviation, thanks! Oct 27 '20 at 10:30
• Thank you so much. This is very clear. Oct 28 '20 at 11:04