diff --git a/pandasai/pipelines/synthetic_dataframe/sdf_code_executor.py b/pandasai/pipelines/synthetic_dataframe/sdf_code_executor.py index 1faf33e6e..1a72c6300 100644 --- a/pandasai/pipelines/synthetic_dataframe/sdf_code_executor.py +++ b/pandasai/pipelines/synthetic_dataframe/sdf_code_executor.py @@ -21,10 +21,7 @@ def execute(self, input: Any, **kwargs) -> Any: if "df" not in namespace: raise ValueError(f"Unable to execute code: {input}") - data = namespace["df"] - - return data - + return namespace["df"] except Exception: logger = kwargs.get("logger") if logger is not None: diff --git a/pandasai/pipelines/synthetic_dataframe/synthetic_df_prompt.py b/pandasai/pipelines/synthetic_dataframe/synthetic_df_prompt.py index 26c5ff1e7..9ce4ae8c3 100644 --- a/pandasai/pipelines/synthetic_dataframe/synthetic_df_prompt.py +++ b/pandasai/pipelines/synthetic_dataframe/synthetic_df_prompt.py @@ -25,8 +25,7 @@ def execute(self, input: Any, **kwargs) -> Any: if context is None or len(context.dfs) == 0: raise ValueError("Dataframe not found") - prompt = GenerateSyntheticDfPrompt( - amount=self._amount, dataframe=context.dfs[kwargs.get("dataframe_index", 0)] + return GenerateSyntheticDfPrompt( + amount=self._amount, + dataframe=context.dfs[kwargs.get("dataframe_index", 0)], ) - - return prompt