ScriptsMar 31, 2026·2 min read

PandasAI — Chat with Your Data Using AI

Conversational data analysis with LLMs. Chat with SQL databases, CSV, Parquet files using natural language. Auto-generates Python/SQL and visualizations. 23K+ stars.

TO
TokRepo精选 · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install pandasai
import pandas as pd
from pandasai import SmartDataframe

df = pd.DataFrame({
    "country": ["USA", "China", "Japan", "Germany", "India"],
    "gdp": [21400, 14700, 5100, 3800, 2900],
    "population": [331, 1402, 126, 83, 1380],
})

sdf = SmartDataframe(df, config={"llm": "openai/gpt-4o"})
response = sdf.chat("Which country has the highest GDP per capita?")
print(response)

Intro

PandasAI makes data analysis conversational. Ask questions about your data in plain English — it generates Python code or SQL queries, executes them, and returns results with auto-generated charts. Works with Pandas DataFrames, SQL databases (PostgreSQL, MySQL, SQLite), CSV, Parquet, and data lakes. 23,000+ GitHub stars.

Best for: Data analysts and scientists who want natural language access to data without writing code Works with: OpenAI, Anthropic, Google, Ollama, any LLM; PostgreSQL, MySQL, SQLite, CSV, Parquet


Key Features

Natural Language Queries

Ask questions like a human — PandasAI figures out the code:

  • "Show me monthly revenue trends"
  • "Which product category has the highest margin?"
  • "Create a scatter plot of price vs. sales"

Auto-Visualization

Generates Matplotlib/Plotly charts automatically when the answer is visual.

Multi-Source

Connect to DataFrames, SQL databases, CSV files, Parquet, and data lakes in one conversation.

Code Transparency

See the generated Python/SQL code before execution. Learn and verify.

Data Privacy

Self-hosted — your data never leaves your infrastructure. No data sent to LLM providers (only schema + question).

Sandbox Execution

Generated code runs in a sandboxed environment for safety.


FAQ

Q: What is PandasAI? A: A conversational data analysis tool. Ask questions about databases, CSVs, and DataFrames in natural language. Auto-generates code and visualizations. 23K+ stars.

Q: Does PandasAI send my data to OpenAI? A: No, only the schema and your question are sent to the LLM. Actual data stays local. You can also use local models via Ollama.


🙏

Source & Thanks

Created by Sinaptik AI. Licensed under custom license. Sinaptik-AI/pandas-ai — 23,000+ GitHub stars

Related Assets