Created
July 18, 2023 20:59
-
-
Save hwchase17/073e8ab6cdcb263f7dca58a6c24c0369 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import pandas as pd | |
from pandasai import PandasAI | |
# Sample DataFrame | |
df = pd.DataFrame({ | |
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"], | |
"gdp": [19294482071552, 2891615567872, 2411255037952, 3435817336832, 1745433788416, 1181205135360, 1607402389504, 1490967855104, 4380756541440, 14631844184064], | |
"happiness_index": [6.94, 7.16, 6.66, 7.07, 6.38, 6.4, 7.23, 7.22, 5.87, 5.12] | |
}) | |
# Instantiate a LLM | |
from langchain.chat_models import ChatAnthropic | |
llm = ChatAnthropic() | |
pandas_ai = PandasAI(llm) | |
pandas_ai(df, prompt='Which are the 5 happiest countries?') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment