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
13.14k stars 1.27k forks source link

FileNotFoundError: [Errno 2] No such file or directory: '/Users/cindy/Documents/AI/jiaoxing/jiaoxing/.venv/lib/python3.11/site-packages/pandasai/pipelines/chat/dataframe.csv' #1418

Open bjpenck opened 10 hours ago

bjpenck commented 10 hours ago

System Info

python3.11/ macos 13.2.1/ pandasai later

After uploading the excel data and querying for a while, this problem always occurs in the end: FileNotFoundError: [Errno 2] No such file or directory: '/Users/cindy/Documents/AI/jiaoxing/jiaoxing/.venv/lib/python3.11/site-packages/pandasai/pipelines/chat/dataframe.csv'

🐛 Describe the bug

llm = LocalLLM(api_base="http://localhost:11434/v1", model="codellama:7b") smart = SmartDataframe(df, config={"llm": llm}) prompt =st.text_area("search..") if(st.button("search")): if prompt: with st.spinner("think.."): st.write(smart.chat(prompt))

dosubot[bot] commented 10 hours ago

Hey @bjpenck! I'm here to help you with any bugs, questions, or contributions. Let's squash those bugs together!

The FileNotFoundError you're encountering suggests that the code is trying to access a file named dataframe.csv in the pandasai package, but it doesn't exist. However, based on the available information, there is no specific mention of a dataframe.csv file being used or generated by the pandasai package. Instead, the package typically uses Parquet files for saving dataframes [1].

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check File Path: Ensure that the file path being referenced is correct and that the file actually exists at that location. If the file is supposed to be generated by your code, verify that the code responsible for creating it is executing correctly.

  2. Review Code Logic: Look into the part of your code where the file path is being set or used. Make sure that the logic aligns with how files are managed in the pandasai package.

  3. Update or Modify Code: If your code or a library you're using expects a CSV file, you might need to adjust it to work with the Parquet format instead, or ensure that the CSV file is created and available at the expected location.

  4. Check for Custom Modifications: If there have been any custom modifications to the pandasai package or your project setup, ensure they are correctly implemented and do not interfere with file paths.

If these steps do not resolve the issue, consider checking the documentation or source code for any additional context on file handling within the pandasai package.

To continue talking to Dosu, mention @dosu.

bjpenck commented 9 hours ago

I did not generate a file in the logic code, but uploaded a data file for data analysis.

bjpenck commented 9 hours ago

TypeError: 'NoneType' object is not subscriptable

2024-10-30 11:44:03 [INFO] Code generated:

            for i in range(len(dfs)):
    df = dfs[i]
    conditions = [(df['order'] >= 500) & (df['order'] <= 1000), (df['number'] >= 1) & (df['number'] <= 50)]
    result = df.query(conditions).to_dict()
    for row in result:
        for col in ['order', 'number']:
            if isinstance(row[col], str):
                try:
                    int(row[col])
                    row[col] = int(row[col])
                except ValueError:
                    pass

2024-10-30 11:44:03 [INFO] Executing Step 2: CodeCleaning 2024-10-30 11:44:03 [INFO] Code running:

for i in range(len(dfs)):
    df = dfs[i]
    conditions = [(df['order'] >= 500) & (df['order'] <= 1000), (df['number'] >= 1) & (df['number'] <= 50)]
    result = df.query(conditions).to_dict()
    for row in result:
        for col in ['order', 'number']:
            if isinstance(row[col], str):
                try:
                    int(row[col])
                    row[col] = int(row[col])
                except ValueError:
                    pass

2024-10-30 11:44:03 [ERROR] Failed with error: Traceback (most recent call last): File "/Users/cindy/Documents/AI/jiaoxing/jiaoxing/.venv/lib/python3.11/site-packages/pandasai/pipelines/chat/code_execution.py", line 85, in execute result = self.execute_code(code_to_run, code_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cindy/Documents/AI/jiaoxing/jiaoxing/.venv/lib/python3.11/site-packages/pandasai/pipelines/chat/code_execution.py", line 171, in execute_code exec(code, environment) File "", line 3, in TypeError: 'NoneType' object is not subscriptable

2024-10-30 11:44:03 [ERROR] Pipeline failed on step 6: 'NoneType' object is not subscriptable


![Uploading 1730260427608.jpg…]()