Selected topic
Data Normalization
Prefer practical output? Use related tools below while reading.
python
import pandas as pd# Create a sample dataset
data = {
'Student': ['A', 'B', 'C'],
'Math Score': [90, 85, 95],
'English Score': [80, 75, 90]
}
df = pd.DataFrame(data)
print("Original Data:")
print(df)
# Normalize data using Min-Max Scaler
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
df[['Math Score', 'English Score']] = scaler.fit_transform(df[['Math Score', 'English Score']])
print("\nNormalized Data (Min-Max Scaler):")
print(df)
Original Data:
Student Math Score English Score
0 A 90.0 80.0
1 B 85.0 75.0
2 C 95.0 90.0Normalized Data (Min-Max Scaler):
Student Math Score English Score
0 A 0.8333 0.6667
1 B 0.6957 0.5833
2 C 0.9722 0.7333