Two ways
>>> import numpy as np >>> import pandas as pd Backend TkAgg is interactive backend. Turning interactive mode on. >>> (1) >>> df_test = ((4,4)* 4 + 3) >>> df_test 0 1 2 3 0 9.497381 0.552974 0.887313 -1.291874 1 6.461631 -6.206155 9.979247 -0.044828 2 4.276156 2.002518 8.848432 -5.240563 3 1.710331 1.463783 7.535078 -1.399565 >>> df_test_1 = df_test >>> df_test.apply(lambda x: (x - (x)) / ((x) - (x))) # Method I 0 1 2 3 0 1.000000 0.823413 0.000000 0.759986 1 0.610154 0.000000 1.000000 1.000000 2 0.329499 1.000000 0.875624 0.000000 3 0.000000 0.934370 0.731172 0.739260 >>> (df_test_1 - df_test_1.min()) / (df_test_1.max() - df_test_1.min())# Method II 0 1 2 3 0 1.000000 0.823413 0.000000 0.759986 1 0.610154 0.000000 1.000000 1.000000 2 0.329499 1.000000 0.875624 0.000000 3 0.000000 0.934370 0.731172 0.739260
Consistent and correct results
Above this pandas for each column of data to standardize the method is all that I share with you, I hope to give you a reference, and I hope you support me more.