Spaces:
Sleeping
Sleeping
Download utils/data_utils.py from saurav384/Medical_Inventory_Model: direct link, hf CLI and curl.
- Browser
- Download file 405 Bytes
-
https://huggingface.co/spaces/saurav384/Medical_Inventory_Model/resolve/main/utils/data_utils.py
- Command line
-
hf download hf://spaces/saurav384/Medical_Inventory_Model/utils/data_utils.py
-
curl -L -o data_utils.py https://huggingface.co/spaces/saurav384/Medical_Inventory_Model/resolve/main/utils/data_utils.py
405 Bytes
| 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 | |