pandasai
Conversational data analysis using natural language queries on pandas DataFrames. Use when you want to ask plain-English questions about data, generate charts, explain transformations, or build exploratory analysis interfaces — all powered by an LLM backend. Supports OpenAI, Anthropic, Google Gemini, Azure OpenAI, and local models. Handles single DataFrames (SmartDataframe) and multi-table joins (SmartDatalake).
Best use case
pandasai is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Conversational data analysis using natural language queries on pandas DataFrames. Use when you want to ask plain-English questions about data, generate charts, explain transformations, or build exploratory analysis interfaces — all powered by an LLM backend. Supports OpenAI, Anthropic, Google Gemini, Azure OpenAI, and local models. Handles single DataFrames (SmartDataframe) and multi-table joins (SmartDatalake).
Teams using pandasai should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pandasai/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pandasai Compares
| Feature / Agent | pandasai | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Conversational data analysis using natural language queries on pandas DataFrames. Use when you want to ask plain-English questions about data, generate charts, explain transformations, or build exploratory analysis interfaces — all powered by an LLM backend. Supports OpenAI, Anthropic, Google Gemini, Azure OpenAI, and local models. Handles single DataFrames (SmartDataframe) and multi-table joins (SmartDatalake).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# PandasAI Skill
> Chat with your data using natural language. Ask questions about DataFrames and get
> insights, visualizations, and explanations powered by LLMs.
## When to Use
**USE when:**
- Exploring an unfamiliar dataset with open-ended natural language questions
- Generating quick visualizations from descriptive prompts
- Explaining complex data transformations to stakeholders
- Building conversational data exploration interfaces (Streamlit, Jupyter, FastAPI)
- Rapid prototyping of data analysis workflows
**DON'T USE when:**
- Production pipelines requiring deterministic, version-controlled outputs
- Processing highly sensitive PII without anonymization (use privacy mode)
- Performance-critical paths with very large DataFrames (>100K rows)
- Simple queries that direct pandas operations would handle faster
## Install
```bash
uv add pandasai # core
uv add pandasai openai # + OpenAI backend
uv add pandasai matplotlib seaborn plotly # + visualization
export OPENAI_API_KEY="sk-..."
# or ANTHROPIC_API_KEY / GOOGLE_API_KEY for other backends
```
## Quick Start
```python
import pandas as pd
from pandasai import SmartDataframe
from pandasai.llm import OpenAI
df = pd.read_csv("data.csv")
smart_df = SmartDataframe(df, config={"llm": OpenAI(model="gpt-4", temperature=0)})
result = smart_df.chat("What is the total revenue by region?")
smart_df.chat("Plot a bar chart of monthly sales") # saves chart to ./charts/
print(smart_df.last_code_generated) # inspect generated code
```
## Core Capabilities
| Capability | API | Notes |
|-----------|-----|-------|
| Natural language query | `smart_df.chat(question)` | Returns value, DataFrame, or chart |
| Multi-table queries | `SmartDatalake([df1, df2]).chat(q)` | Assign `df.name` before passing |
| Inspect code | `smart_df.last_code_generated` | Verify correctness |
| Enable caching | `config={"enable_cache": True}` | Avoids repeat LLM calls |
| Privacy mode | `config={"enforce_privacy": True}` | Anonymize sensitive columns first |
| Chart saving | `config={"save_charts": True, "save_charts_path": "./charts"}` | Auto-saves matplotlib figures |
## Supported LLM Backends
| Provider | Import class | Env var |
|----------|-------------|---------|
| OpenAI | `from pandasai.llm import OpenAI` | `OPENAI_API_KEY` |
| Anthropic | `from pandasai.llm import Anthropic` | `ANTHROPIC_API_KEY` |
| Google Gemini | `from pandasai.llm import GoogleGemini` | `GOOGLE_API_KEY` |
| Azure OpenAI | `from pandasai.llm import AzureOpenAI` | `AZURE_OPENAI_API_KEY` |
| Local (Ollama) | `from pandasai.llm import LocalLLM` | — |
Switch backends by passing a different `llm=` object to `config`. For fallback logic,
see `MultiBackendAnalyzer` in `references/api-reference.md`.
## Privacy Pattern (Quick)
```python
import hashlib
safe_df = df.copy()
for col in ["name", "email", "ssn"]:
safe_df[col] = safe_df[col].apply(lambda x: hashlib.md5(str(x).encode()).hexdigest()[:8])
smart_df = SmartDataframe(safe_df, config={"llm": llm, "enforce_privacy": True, "enable_cache": False})
```
See `references/api-reference.md` for full `PrivacyAwareAnalyzer` with audit logging.
## Key Gotchas
- **Determinism**: Set `temperature=0` for reproducible results.
- **Large DataFrames**: Sample to ≤10K rows before wrapping to avoid context overflow.
- **Cache invalidation**: Cache keys are per-question string; data changes don't auto-invalidate.
- **Chart display**: In headless environments set matplotlib backend to `Agg` before import.
- **Multi-table**: Assign `df.name = "table_name"` before passing list to `SmartDatalake`.
## References
- Full code examples (all 6 capabilities): `references/api-reference.md`
- Integration patterns (Streamlit, FastAPI, Jupyter): `references/api-reference.md`
- Best practices, caching, cost management: `references/api-reference.md`
- Troubleshooting table: `references/api-reference.md`
- Upstream docs: https://docs.pandas-ai.com/
- GitHub: https://github.com/gventuri/pandas-ai
## Version History
- **1.0.0** (2026-01-17): Initial release — NL queries, chart generation, multi-backend, privacy modesRelated Skills
pyproject-toml
Configure Python projects with pyproject.toml for modern packaging, tools, and dependency management
python-scientific-computing
Python for engineering analysis, numerical computing, and scientific workflows using NumPy, SciPy, SymPy
pandas-data-processing
Pandas for time series analysis, OrcaFlex results processing, and marine engineering data workflows
numpy-numerical-analysis
NumPy for matrix operations, FFT, linear algebra, and numerical computations in marine engineering
docx-templates
Template-based Word document generation using Jinja2 syntax. Create reports, contracts, and documents with loops, conditionals, tables, and mail merge capabilities.
ydata-profiling
Automated data quality reports with comprehensive variable analysis, missing value detection, correlations, and HTML report generation - formerly pandas-profiling
sweetviz
Automated EDA comparison reports with target analysis, feature comparison, and HTML report generation for pandas DataFrames
great-tables
Publication-quality tables in Python with rich styling, formatting, conditional formatting, and export to HTML/images - inspired by R's gt package
bsee-sodir-extraction
Extract and process energy data from BSEE (Gulf of Mexico) and SODIR (Norway) regulatory databases
autoviz
Automatic exploratory data analysis and visualization with a single line of code - generates comprehensive charts, detects patterns, and exports to HTML/notebooks
langchain
Build production-ready LLM applications with chains, agents, memory, tools, and RAG pipelines using the LangChain framework
test-oversized-skill
A test fixture skill that exceeds 200 lines with multiple H2/H3 sections for split testing.