Scripts2026年3月31日·1 分钟阅读

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
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

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)

介绍

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.


🙏

来源与感谢

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

相关资产