Find answers from the community

d
davong
Offline, last seen 3 months ago
Joined September 25, 2024
d
davong
·

Pandas

hello, please help. Im currently using subquestion query with pandasquery as tools. but when the query is "What date is today?" the pandas generate code returning error, here the generate code

Pandas Instructions:
Plain Text
df[(df['DATE'] == datetime.date.today()) & (df['AIRPORT'] == 'CGK')]['realization_passenger'].sum()

df[(df['DATE'] == datetime.date.today()) & (df['AIRPORT'] == 'CGK')]['realization_passenger'].sum()
Traceback (most recent call last):
File "/Users/digitalservicet3/miniforge3/lib/python3.10/site-packages/llama_index/query_engine/pandas_query_engine.py", line 60, in default_output_processor
raise e
File "/Users/digitalservicet3/miniforge3/lib/python3.10/site-packages/llama_index/query_engine/pandas_query_engine.py", line 58, in default_output_processor
return str(eval(module_end_str, {"np": np}, local_vars))
File "<string>", line 1, in <module>
NameError: name 'datetime' is not defined
Pandas Output: There was an error running the output as Python code. Error message: name 'datetime' is not defined

error is because it not generate the import first. how im suppose to do to solve that error,
thankyou
2 comments
d
L
d
davong
·

Memory

hello if there any memory chat function on subquestion query?
7 comments
d
L