Home/
Part XII — Building Real Products (End-to-End Projects)/36. Project 5: Data-to-Insights Analyst Tool/36.2 Ask questions in natural language; answer in charts/tables
36.2 Ask questions in natural language; answer in charts/tables
Overview and links for this section of the guide.
On this page
The "Pandas" Prompt
You have a pandas DataFrame named `df`.
The columns are: [date, sales, region].
The user asks: "Plot sales by region."
Write python code to create this plot using matplotlib.
Save the plot to 'output.png'.
Do not print the dataframe.
Handling the Output
The model returns Python code. You run it. It generates `output.png`. You display that image to the user.
If the user asks for a table ("Show me top 5"), the code should print a JSON string or CSV, which your frontend parses and renders as a grid.