Spaces:
Sleeping
Sleeping
File size: 559 Bytes
010071f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import pandas as pd
import matplotlib.pyplot as plt
from google.adk.tools import Tool
@Tool(name="plot_sales_tool", description="Plot sales trend over time")
def plot_sales(file_path: str) -> str:
df = pd.read_csv(file_path)
if 'Month' not in df.columns or 'Sales' not in df.columns:
return "Missing 'Month' or 'Sales' columns."
plt.figure(figsize=(10, 6))
plt.plot(df['Month'], df['Sales'], marker='o')
plt.xticks(rotation=45)
plt.title("Sales Trend")
plt.savefig("sales_plot.png")
return "Generated sales_plot.png"
|