Spaces:
Sleeping
Sleeping
import pandas as pd | |
def analyze_excel(filepath: str) -> str: | |
df = pd.read_excel(filepath) | |
# Summing up all numeric food items if 'category' exists | |
if 'category' in df.columns and 'amount' in df.columns: | |
food_sales = df[df['category'].str.lower() == 'food'] | |
return f"{food_sales['amount'].sum():.2f}" | |
return "0.00" | |