Find answers from the community

Updated last year

Hi all I m trying to use the

Hi all, I'm trying to use the PandasQueryEngine to query some csv data I have. Im running into an issue where it's generating some invalid python syntax though. Does anyone have any experience with this?
n
2 comments
Here's the sampel input/output:
Plain Text
> Current query: 
    - What patterns or trends are you seeing in the data? Be specific and quantify metrics such as: percentage items unsold, pricing vs sold amount, unsold categories and highest sold category.
    - Based on your data analysis and your review of our existing Sale flow, what ideas do you have for how we could improve the resale rate of our returns?
    - List 5-10 ideas with a short justification for why you chose each one.
    
> New query:  What is the pricing vs sold amount in the e commerce sales data?
> Pandas Instructions:


eval(df.groupby('flash_sale_sold')['flash_sale_pre_discount_price'].mean())
Plain Text
> Pandas Output: There was an error running the output as Python code. Error message: eval() arg 1 must be a string, bytes or code object
Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/llama_index/query_engine/pandas_query_engine.py", line 58, in default_output_processor
    raise e
  File "/opt/conda/lib/python3.11/site-packages/llama_index/query_engine/pandas_query_engine.py", line 56, in default_output_processor
    return str(eval(module_end_str, {}, local_vars))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
TypeError: eval() arg 1 must be a string, bytes or code object
Add a reply
Sign up and join the conversation on Discord