Spaces:
Sleeping
Sleeping
| import pandas as pd | |
| def load_data(file): | |
| if file.name.endswith(".csv"): | |
| df = pd.read_csv(file) | |
| elif file.name.endswith(".xlsx"): | |
| df = pd.read_excel(file) | |
| else: | |
| df = pd.read_json(file) | |
| df["Expiry_Date"] = pd.to_datetime(df["Expiry_Date"], errors="coerce") | |
| df["Purchase_Date"] = pd.to_datetime(df["Purchase_Date"], errors="coerce") | |
| return df | |