Clean Up Product Names Using str.strip()
📖 Scenario: You work in a store's data team. The product names in the sales data have extra spaces at the start or end. This makes it hard to analyze the data correctly.
🎯 Goal: You will clean the product names by removing extra spaces using str.strip() in pandas.
📋 What You'll Learn
Create a pandas DataFrame with product names including extra spaces
Create a variable to hold the column name 'Product'
Use
str.strip() on the product names to remove spacesPrint the cleaned product names column
💡 Why This Matters
🌍 Real World
Cleaning text data is a common task in data science to prepare data for analysis or machine learning. Extra spaces can cause errors or wrong results.
💼 Career
Data scientists and analysts often clean messy data like product names, customer info, or survey answers before working with it.
Progress0 / 4 steps