Open Nitheeswaran-E opened 1 month ago
Привет, @Nitheeswaran-E! Я здесь, чтобы помочь вам с вашей проблемой.
To resolve the issue where the Pandas Query Engine works correctly in a Jupyter notebook but throws a KeyError
when executed as a standalone .py
file, ensure that the column names used in your queries match exactly with the column names in your DataFrame. This includes checking for any leading or trailing spaces, case sensitivity, and special characters.
In your case, the KeyError: 'Time generated'
suggests that the column 'Time generated' might not exist in the DataFrame when running the standalone script. Verify that the DataFrame df
in your standalone script is correctly defined and contains the column 'Time generated'.
You can add debugging statements to print the DataFrame columns before querying to confirm the DataFrame structure:
print(df.columns)
This will help you ensure that the DataFrame has the expected columns when running the standalone script [1].
To continue talking to Dosu, mention @dosu.
Bug Description
if pandas query engine run in a jupyter notebook it gives a proper result, but it does not give a proper result if runned as a single .py file
Version
llama-index==0.10.50
Steps to Reproduce
making it as a single .py file
Relevant Logs/Tracbacks