import pandas as pd def clean_upi_data(df): df['Date'] = pd.to_datetime(df['Date'], format="%d-%m-%Y") df['Category'] = df['Description'].apply(lambda x: categorize_transaction(x)) return df def categorize_transaction(description): keywords = { "Food": ["Zomato", "Swiggy", "Restaurant"], "Shopping": ["Amazon", "Flipkart", "Myntra"], "Bills": ["Electricity", "Gas", "Water"], "Travel": ["Uber", "Ola", "IRCTC"], } for category, words in keywords.items(): if any(word.lower() in description.lower() for word in words): return category return "Other"