Skip to content

Commit

Permalink
add pandasai
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Sep 28, 2024
1 parent 543edd9 commit 1257686
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions book/pandas/additionallibs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,51 @@
"\n",
"df = pd.read_csv(\"\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Chat with your Dataframe with `PandasAI`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can chat with your Pandas dataframe with a few lines of code.\n",
"\n",
"With `PandasAI`, you can use LLMs to analyze your data, generate visuals, and create a report with your words.\n",
"\n",
"Currently, `PandasAI` supports popular LLMs from providers like OpenAI, Anthropic, Google, Amazon, or Ollama for local LLMs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install pandasai"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pandasai import SmartDataframe\n",
"from pandasai.llm import OpenAI\n",
"from pandasai.helpers.openai_info import get_openai_callback\n",
"\n",
"llm = OpenAI()\n",
"\n",
"df = SmartDataframe(\"data.csv\", config={\"llm\": llm, \"conversational\": False})\n",
"\n",
"with get_openai_callback() as cb:\n",
" response = df.chat(\"Calculate the sum of the gdp of north american countries\")"
]
}
],
"metadata": {
Expand Down

0 comments on commit 1257686

Please sign in to comment.