Smart_Dashboard / chatbot /data_query.py
Muthuraja18's picture
Upload 14 files (#1)
33d1c37
raw
history blame contribute delete
326 Bytes
import pandas as pd
def query_dashboard_data(filepath, question):
df = pd.read_csv(filepath)
if "highest" in question.lower():
return df.max(numeric_only=True).to_dict()
elif "average" in question.lower():
return df.mean(numeric_only=True).to_dict()
return "Query not recognized"