Skip to content

How to modify the response of pandasai #1307

Closed as not planned
Closed as not planned
@junle-chen

Description

I have a question:
What is the average, minimum, and maximum age for all French singers?
and I use the following code

response = agent.chat(question)
print(response)
print(agent.last_code_executed)

and the output is

The average age of French singers is 34.5. The minimum age is 25, and the maximum age is 43.
french_singers = dfs[0][dfs[0]['Country'] == 'France']
average_age = french_singers['Age'].mean()
min_age = french_singers['Age'].min()
max_age = french_singers['Age'].max()
result = {'type': 'string', 'value': f'The average age of French singers is {average_age}. The minimum age is {min_age}, and the maximum age is {max_age}.'}

I don't want this kind of result output, I need the output to be a list, like[{average_age}, {min_age}, {max_age}]. I don't need to include the extra string.
How can I modify the response of pandasai?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions