Freelancers using NotchFreelancers using Notchimport pandas as pd
# Load messy e-commerce data
df = pd.read_excel('ecommerce_products.xlsx')
# 1. Remove duplicates
df = df.drop_duplicates()
# 2. Clean price column (remove $ sign)
df['Price'] = df['Price'].replace('[\$,]', '', regex=True).astype(float)
# 3. Standardize category names
df['Category'] = df['Category'].str.title()
# 4. Fill missing stock with 0
df['Stock'] = df['Stock'].fillna(0)
# 5. Save clean file
df.to_excel('clean_products.xlsx', index=False)
print(f"Done! Cleaned {len(df)} products.")