import pandas as pd, json
df = pd.read_excel('/Users/maxim.ziatdinov/Code/SciLink/planning_session_20260319_180040/knowledge/PWSdatabase.xlsx')
elements = ['Li', 'Sr', 'Ba', 'Cu', 'Na', 'Mg', 'K', 'Ca']
df_elements = df.loc[1:, elements].apply(pd.to_numeric, errors='coerce')
stats = df_elements.agg(['mean', 'median', 'min', 'max', 'count']).round(4)
answer = stats.to_dict()
summary = f"Summary statistics (mean, median, min, max, count) for Li, Sr, Ba, Cu, Na, Mg, K, Ca concentrations: {json.dumps(answer, default=str)}"
print(json.dumps({"answer": answer, "summary": summary}))
