Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
11.69k stars 1.08k forks source link

NameError: name 'pl' is not defined #1162

Open aby1234567 opened 1 month ago

aby1234567 commented 1 month ago

System Info

OS version - Windows 11 pandasai version - 2.0.42 python version - 3.11.5

🐛 Describe the bug

Im trying to use Agent or smartdataframe with polars and this is the issue that i'm getting.

2024-05-17 09:27:55.420 Uncaught app exception Traceback (most recent call last): File "C:\Users\aby\anaconda3\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 60 00, in _run_script exec(code, module.dict) File "C:\Users\aby\Untitled Folder\Streamlit Project\Analyze_with_AI.py", line 77, in sdf = SmartDataframe(df, config={"llm": llm}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aby\anaconda3\Lib\site-packages\pandasai\smart_dataframe__init.py", line 62, in init self._agent = Agent([df], config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aby\anaconda3\Lib\site-packages\pandasai\agent\base.py", line 72, in init dfs = self.get_dfs(dfs) ^^^^^^^^^^^^^^^^^ File "C:\Users\aby\anaconda3\Lib\site-packages\pandasai\agent\base.py", line 211, in get_dfs connectors.append(PolarsConnector({"original_df": df})) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aby\anaconda3\Lib\site-packages\pandasai\connectors\polars.py", line 66, in init__
self._load_df(self.config.original_df) File "C:\Users\aby\anaconda3\Lib\site-packages\pandasai\connectors\polars.py", line 76, in _load_df
if isinstance(df, pl.Series): ^^ NameError: name 'pl' is not defined

gventuri commented 1 month ago

@aby1234567 do you have polars installed?

aby1234567 commented 1 month ago

@gventuri yes, i have it installed, polars version : 0.20.26