From 5acac65f2b43320c81c0ce911044deda257537d8 Mon Sep 17 00:00:00 2001 From: Sermet Pekin Date: Wed, 17 Apr 2024 05:56:43 +0300 Subject: [PATCH] catch --- evdspy/EVDSlocal/index_requests/user_requests.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/evdspy/EVDSlocal/index_requests/user_requests.py b/evdspy/EVDSlocal/index_requests/user_requests.py index 371b8dd..cdc375a 100644 --- a/evdspy/EVDSlocal/index_requests/user_requests.py +++ b/evdspy/EVDSlocal/index_requests/user_requests.py @@ -354,13 +354,22 @@ def is_ok(self) -> bool: return ok +import traceback + + class DataProcessor: def __init__(self, data: Any): self.data = data - def process_to_dataframe(self) -> pd.DataFrame: - df = json_to_df(self.data) - df = make_df_float(df) + def process_to_dataframe(self) -> Optional[pd.DataFrame]: + try: + df = json_to_df(self.data) + except Exception as e: + print(e) + traceback.print_exc() + return None + if isinstance(df, pd.DataFrame): + df = make_df_float(df) return df def __call__(self, *args, **kwargs) -> pd.DataFrame: