0
0
Data Analysis Pythondata~20 mins

Scaling and normalization concepts in Data Analysis Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Scaling and Normalization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of Min-Max Scaling on a Simple Array
What is the output of the following code that applies Min-Max scaling to a numpy array?
Data Analysis Python
import numpy as np
from sklearn.preprocessing import MinMaxScaler

arr = np.array([[10], [20], [30], [40], [50]])
scaler = MinMaxScaler()
scaled_arr = scaler.fit_transform(arr)
print(scaled_arr.flatten())
A[0.2 0.4 0.6 0.8 1. ]
B[10. 20. 30. 40. 50.]
C[0. 0.25 0.5 0.75 1. ]
D[1. 0.75 0.5 0.25 0. ]
Attempts:
2 left
💡 Hint
Min-Max scaling transforms data to a range between 0 and 1 based on the minimum and maximum values.
data_output
intermediate
2:00remaining
Effect of Standardization on Data Mean and Std Dev
After applying standard scaling (z-score normalization) to this data, what are the mean and standard deviation of the transformed data?
Data Analysis Python
import numpy as np
from sklearn.preprocessing import StandardScaler

data = np.array([[5], [10], [15], [20], [25]])
scaler = StandardScaler()
scaled_data = scaler.fit_transform(data)
mean = scaled_data.mean()
std = scaled_data.std()
print(round(mean, 2), round(std, 2))
A0.0 1.0
B5.0 7.07
C10.0 5.0
D1.0 0.0
Attempts:
2 left
💡 Hint
StandardScaler centers data to mean 0 and scales to std dev 1.
🔧 Debug
advanced
2:00remaining
Identify the Error in Normalizing Data with sklearn
What error will this code raise when trying to normalize data using sklearn's Normalizer?
Data Analysis Python
from sklearn.preprocessing import Normalizer

X = [[1, 2], [3, 4], [5, 6]]
normalizer = Normalizer(norm='l3')
X_normalized = normalizer.transform(X)
print(X_normalized)
ANo error, prints normalized array
BTypeError: 'list' object is not callable
CAttributeError: 'Normalizer' object has no attribute 'transform'
DValueError: norm must be one of {'l1', 'l2', 'max'}
Attempts:
2 left
💡 Hint
Check the allowed norm parameters for Normalizer.
🚀 Application
advanced
2:00remaining
Choosing Scaling Method for Skewed Data
You have a dataset with a feature that is heavily skewed to the right (many small values, few very large values). Which scaling method is best to prepare this feature for a machine learning model?
ALog transformation followed by standardization
BStandardization (z-score) to center data with mean 0 and std dev 1
CMin-Max scaling to scale values between 0 and 1
DNo scaling needed for skewed data
Attempts:
2 left
💡 Hint
Skewed data often benefits from transformations that reduce skewness before scaling.
🧠 Conceptual
expert
2:00remaining
Understanding Differences Between Scaling and Normalization
Which statement correctly describes the difference between scaling and normalization in data preprocessing?
AScaling adjusts data distribution shape; normalization adjusts data range
BScaling changes data to a specific range; normalization changes data to have mean 0 and std dev 1
CScaling and normalization are the same and can be used interchangeably
DNormalization changes data to a specific range; scaling changes data to have mean 0 and std dev 1
Attempts:
2 left
💡 Hint
Think about Min-Max scaling vs StandardScaler.