pandas-ai
pandas-ai copied to clipboard
using 'field_descriptions' is giving an error
System Info
OS version: ubuntu-22.04 Python version: 3.9 The current version of pandasai being used: 2.0.2
🐛 Describe the bug
field_descriptions = {
'_id': 'The unique identifier for each lead',
'Status': 'Status of the lead',
'Created At': 'the date at which the lead is generated or created)'
}
connector = PandasConnector(leads_df, field_descriptions=field_descriptions)
is giving an error
File "/home/purandara/anaconda3/envs/propflo-ai2/lib/python3.9/site-packages/pandasai/connectors/pandas.py", line 52, in __init__
self._load_df(self.config.original_df)
File "/home/purandara/anaconda3/envs/propflo-ai2/lib/python3.9/site-packages/pandas/core/generic.py", line 5902, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'original_df'
@gventuri
Same issue here (new user).
Workaround right now:
from pandasai.connectors import PandasConnector
from pandasai.connectors.pandas import PandasConnectorConfig
connector = PandasConnector(PandasConnectorConfig(original_df=leads_df), field_descriptions=field_descriptions)
According to source code, you can pass a dict also, something like {"original_df": leads_df}
instead of instance of PandasConnectorConfig
.
Issue seems to be in method PandasConnector._load_connector_config()
@prise6 This work around resolved the issue.
Thanks
Thanks a lot for investigating @prise6, we'll fix it in the next version!