0
0
Data Analysis Pythondata~30 mins

Scaling and normalization concepts in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Scaling and normalization concepts
📖 Scenario: You work as a data analyst. You have a list of heights of people in centimeters. You want to prepare this data for analysis by scaling and normalizing it. This helps to compare values fairly and use them in machine learning later.
🎯 Goal: Learn how to scale and normalize a list of numbers using simple Python code. You will create the data, set a scale range, apply min-max scaling, and then normalize the scaled data.
📋 What You'll Learn
Create a list of heights with exact values
Create variables for minimum and maximum scale values
Apply min-max scaling to the heights list
Normalize the scaled heights using L2 norm
Print the final normalized list
💡 Why This Matters
🌍 Real World
Scaling and normalization are common steps in preparing data for machine learning and statistics. They help algorithms work better by making data comparable.
💼 Career
Data analysts and data scientists often need to scale and normalize data before building models or visualizations.
Progress0 / 4 steps
1
Create the heights data list
Create a list called heights with these exact values: 150, 160, 170, 180, 190.
Data Analysis Python
Hint

Use square brackets to create a list and separate numbers with commas.

2
Set the scale range for min-max scaling
Create two variables: min_scale set to 0 and max_scale set to 1 to define the scaling range.
Data Analysis Python
Hint

Just assign 0 to min_scale and 1 to max_scale.

3
Apply min-max scaling to the heights list
Create a new list called scaled_heights using a list comprehension. Scale each height using min-max scaling formula: (height - min(heights)) / (max(heights) - min(heights)) * (max_scale - min_scale) + min_scale.
Data Analysis Python
Hint

Use a list comprehension with the formula given to scale each height.

4
Normalize the scaled heights and print the result
Import math module. Calculate the L2 norm of scaled_heights as the square root of the sum of squares. Create a list called normalized_heights by dividing each scaled height by the L2 norm. Finally, print normalized_heights.
Data Analysis Python
Hint

Use math.sqrt and sum of squares to find L2 norm. Then divide each scaled height by this norm.