Spaces:
Running
Running
| import pandas as pd | |
| import joblib | |
| def load_model_and_data(): | |
| with open("app/data/lightgbm_deuda.pkl", "rb") as file: | |
| model = joblib.load(file) | |
| df = pd.read_csv("app/data/data_finance.csv") | |
| df = df.set_index("invoiceId") | |
| return df, model | |
| def prepare_data(df: pd.DataFrame = None) -> pd.DataFrame: | |
| """ | |
| Prepare data. | |
| """ | |
| df = df.drop(["Unnamed: 0", "overdueDays"], axis=1) | |
| df = df.drop(["businessId", "payerId"], axis=1) | |
| df = df[ | |
| [ | |
| "receiptAmount", | |
| "relationDays", | |
| "relationRecurrence", | |
| "issuerInvoicesAmount", | |
| "issuerCancelledInvoices", | |
| "activityDaysPayer", | |
| "clients12Months", | |
| ] | |
| ] | |
| return df.copy() | |