A normalized table converts nested order data into a flat tabular structure: each product becomes a row, while shared fields such as order_id and status repeat across its products. section 2.2.1
A practical normalization pipeline can:
- Exclude canceled orders before expanding product arrays. section 2.2.1
- Extract product_name, brand, and color from descriptions with regular expressions. section 2.2.1
- Compute price_with_tax using 20% for completed orders and 10% for pending orders. section 2.2.1
Order products as rows
An order containing Nike Air Max and Adidas Ultraboost produces two rows with repeated order_id and status values. A pending Puma Speedcat produces one row; the canceled Reebok order produces none. section 2.2.1
Table 2.1 Example DataFrame
|
order_id
|
status
|
product_name
|
brand
|
color
|
price
|
quantity
|
price_with_tax
|
|
1
|
completed
|
Air Max
|
Nike
|
Red
|
120
|
1
|
144
|
|
1
|
completed
|
Ultraboost
|
Adidas
|
Black
|
150
|
2
|
180
|
|
2
|
pending
|
Speedcat
|
Puma
|
White
|
90
|
3
|
99
|
Inspect the resulting DataFrame schema and computed values for the normalized product rows. section 2.2.1
