Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Oct 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bjpenck
Copy link

bjpenck commented Oct 30, 2024

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 dosubot bot added the bug Something isn't working label Oct 30, 2024
Copy link

dosubot bot commented Oct 30, 2024

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
Copy link
Author

bjpenck commented Oct 30, 2024

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

@bjpenck
Copy link
Author

bjpenck commented Oct 30, 2024

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 "<string>", line 3, in <module>
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…]()


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant