forked from Sinaptik-AI/pandas-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use conversational=False by default
As data analysts need a non-conversational answer most of the times, we make it so it returns the actual dataframe instead
- Loading branch information
Showing
8 changed files
with
70 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
"""Example of using PandasAI on multiple Pandas DataFrame""" | ||
|
||
import pandas as pd | ||
|
||
from pandasai import PandasAI | ||
from pandasai.llm.openai import OpenAI | ||
|
||
employees_data = { | ||
'EmployeeID': [1, 2, 3, 4, 5], | ||
'Name': ['John', 'Emma', 'Liam', 'Olivia', 'William'], | ||
'Department': ['HR', 'Sales', 'IT', 'Marketing', 'Finance'] | ||
"EmployeeID": [1, 2, 3, 4, 5], | ||
"Name": ["John", "Emma", "Liam", "Olivia", "William"], | ||
"Department": ["HR", "Sales", "IT", "Marketing", "Finance"], | ||
} | ||
|
||
salaries_data = { | ||
'EmployeeID': [1, 2, 3, 4, 5], | ||
'Salary': [5000, 6000, 4500, 7000, 5500] | ||
"EmployeeID": [1, 2, 3, 4, 5], | ||
"Salary": [5000, 6000, 4500, 7000, 5500], | ||
} | ||
|
||
employees_df = pd.DataFrame(employees_data) | ||
salaries_df = pd.DataFrame(salaries_data) | ||
|
||
|
||
llm = OpenAI() | ||
pandas_ai = PandasAI(llm, verbose=True) | ||
pandas_ai = PandasAI(llm, verbose=True, conversational=True) | ||
response = pandas_ai([employees_df, salaries_df], "Who gets paid the most?") | ||
print(response) | ||
# Output: Olivia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters