0
0
Data Analysis Pythondata~10 mins

Scaling and normalization concepts in Data Analysis Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to scale the data using Min-Max scaling.

Data Analysis Python
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
data_scaled = scaler.[1](data)
Drag options to blanks, or click blank then click option'
Afit_transform
Btransform
Cfit
Dscale
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transform' without fitting first causes an error.
Using 'fit' alone does not transform the data.
2fill in blank
medium

Complete the code to normalize the data using L2 norm.

Data Analysis Python
from sklearn.preprocessing import Normalizer
normalizer = Normalizer(norm='[1]')
data_normalized = normalizer.fit_transform(data)
Drag options to blanks, or click blank then click option'
Anone
Bmax
Cl1
Dl2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'l1' norm changes the scaling method.
Using 'max' norm scales by the maximum value, not L2.
3fill in blank
hard

Fix the error in the code to standardize the data.

Data Analysis Python
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
data_standardized = scaler.[1](data)
Drag options to blanks, or click blank then click option'
Ascale
Btransform
Cfit_transform
Dfit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'transform' without fitting causes an error.
Using 'fit' alone does not transform the data.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.

Data Analysis Python
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B<=
C>
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' includes words of length 3 or less.
Using 'word' instead of 'len(word)' gives the word itself, not its length.
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase words mapped to their lengths for words longer than 4 characters.

Data Analysis Python
result = { [1]: [2] for word in words if len(word) [3] 4 }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
C>
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'word.lower()' instead of uppercase.
Using '<' or '<=' instead of '>' for filtering.