You've seen how to encode categories into numbers and how NumPy arrays make data processing efficient. Let's practice choosing the right encoding method and understanding the properties of NumPy arrays.
Engagement Message
Ready to apply what you've learned?
Type
Swipe Left or Right
Practice Question
Which encoding method is most appropriate for these categorical features? Swipe each feature to the correct encoding type.
Labels
- Left Label: One-Hot Encoding
- Right Label: Ordinal Encoding
Left Label Items
- Car Brand (Toyota, Ford, Honda)
- Country of Origin (USA, Japan, Germany)
- Movie Genre (Comedy, Drama, Action)
Right Label Items
- T-Shirt Size (S, M, L, XL)
- Customer Satisfaction (Low, Medium, High)
- Education Level (High School, Bachelor's, Master's)
Type
Fill In The Blanks
Markdown With Blanks
This table shows one-hot encoded data for a 'Department' feature. Fill in the original category for each row.
The first row represents the [[blank:Sales]] department. The second row represents the [[blank:Engineering]] department.
Suggested Answers
- Sales
- Engineering
- HR
Type
Multiple Choice
Practice Question
If you create a NumPy array from the list [10.0, 20.0, 30.0, 40.0]
, what will its dtype
be?
A. int64 B. float64 C. string D. object
Suggested Answers
- A
- B - Correct
- C
- D
Type
Sort Into Boxes
Practice Question
Sort these array properties into the correct boxes.
Labels
- First Box Label: Shape
- Second Box Label: Dtype
First Box Items
- (3, 4)
- (100,)
- (5, 2, 3)
Second Box Items
- int64
- float64
- bool
Type
Fill In The Blanks
Markdown With Blanks
Let's use NumPy's vectorization. Fill in the blank to show the result of the code.
The value of prices_with_tax
will be [[blank:[108. 216. 324.]]]
.
Suggested Answers
- [108. 216. 324.]
- [101.08 201.08 301.08]
- An error
