Skip to main content

🧠 DataWhisperer

Talk to your DataFrame. Literally.

DataWhisperer is a professional-grade Python library that enables interaction with pandas DataFrames using natural language. Powered by LLMs like OpenAI and Google Gemini, it transforms analytical questions into executable Python code. Whether you need summaries, transformations, or visualizations, DataWhisperer delivers accurate results and adapts dynamically to your data structure.

✨ No more .groupby(), .pivot() or plotting boilerplate. Just whisper to your data.


🚀 Key Features

  • 🔗 Natural Language to Python code conversion for DataFrames
  • 📊 Auto-generated visualizations with Plotly
  • 🛠️ Automatic error detection & self-repair with multi-step retry logic
  • 🧠 Supports OpenAI, Gemini, and is extensible to Claude, LLaMA, Mistral (coming soon)
  • 🔁 Smart retry strategy for broken code (max_retries)
  • 🧼 Schema-driven prompt system (auto-describes your columns)
  • 🧪 Modular and testable architecture
  • 🧩 Plugin-ready and LLM-client agnostic (future-proof)

📦 Installation

Install from TestPyPI:

pip install -i https://test.pypi.org/simple/ datawhisperer

Or, for local development:

git clone https://github.com/JosueARz/DataWhisperer.git
cd DataWhisperer
pip install -e .

Requirements: Python 3.8+


⚡ Quick Start

from datawhisperer import DataFrameChatbot
import pandas as pd

# Load your dataset
data = pd.read_csv("sales_data.csv")

# Describe the columns
schema = {
    "region": "Sales region (e.g., North, South, East, West)",
    "sales": "Amount of revenue generated",
    "date": "Date of the sale"
}

# Create the chatbot
bot = DataFrameChatbot(
    api_key="your-api-key",
    model="gpt-4",  # or "gemini-1.5-flash"
    dataframe=data,
    schema=schema,
    max_retries=3  # Number of auto-repair attempts if execution fails
)

# Ask a question
response = bot.ask_and_run("Show a bar chart of total sales per region")

# Display result
print(response.text)
response.table  # Or: response.chart

🧠 What kind of questions can I ask?

  • "Which region had the highest revenue in Q2?"
  • "Show average sales by month."
  • "Plot a heatmap of transactions by region and month."
  • "How many sales were made after July 15th?"
  • "Which regions had declining revenue trends over time?"

DataWhisperer will generate optimized and runnable Python code — and automatically fix it if it fails.


✅ Example Output

🔍 Input (user question):

"What are the top 3 regions by total sales?"

🧪 Output (Python code):

import pandas as pd
import plotly.express as px

# Group and sort data
top_regions = df.groupby("region")["sales"].sum().sort_values(ascending=False).head(3).reset_index()
print("Top 3 regions by total sales:")

# Display table
top_regions

📋 Output (text + table):

Top 3 regions by total sales:
region sales
North 102,400.0
East 98,900.0
South 87,120.0

🧪 Testing the Library

pytest
pytest --cov=datawhisperer --cov-report=term-missing

Coverage Includes:

  • Code generation & formatting (PromptFactory)
  • Code execution & error repair (executor.py)
  • Retry logic & self-healing (fixer.py)
  • Chat interface orchestration (DataFrameChatbot)

Note: Tests use fake LLM clients to avoid real API calls.


📌 Version

Current release: v0.1.4

See the CHANGELOG.md for updates.

Upcoming versions will include:

  • SQL + Python-SQL modes
  • Multiple LLM client support
  • DuckDB, SQLite, Postgres connectors
  • CLI + Streamlit interface
  • Plugin hooks

📖 Documentation

Full documentation will be hosted via MkDocs in future release v1.0.0.

  • Quickstart & API Reference
  • Examples & Recipes
  • Plugin Development Guide

📄 License

Apache License 2.0 — use it freely, contribute professionally. © 2024 JosueARz


🤝 Contributing

Pull requests are welcome. Please ensure your changes are:

  • Type hinted and PEP8-compliant
  • Tested with pytest
  • Explained clearly in PR descriptions

🧙 Why "Whisperer"?

Because it doesn’t just chat — it understands your data.

Metadata

Release files for datawhisperer 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datawhisperer 0.1.4
File Size Uploaded Provenance
datawhisperer-0.1.4.tar.gz 22.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for datawhisperer 0.1.4
File Interpreter ABI Platform
datawhisperer-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / datawhisperer-0.1.4.tar.gz

Download URL datawhisperer-0.1.4.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8de87857965532f5ed7a91e790cf21610e7fe29ecb69fab62dd83100dced3ec0
BLAKE2b-256 checksum
How to use checksums
13cd82f34f77426fad84d7515549dd910996c5deef65070e6bfc2a79a1661ae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Release files / datawhisperer-0.1.4-py3-none-any.whl

Download URL datawhisperer-0.1.4-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d36ff6722d4c4af189ba0a182b9ac51d568fbed5c8bd13a63114612219ec3db9
BLAKE2b-256 checksum
How to use checksums
0d0b2bd5d232ebe20d07f8dac3e25294b565f4abc78283fd598d2090872a48e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Security for datawhisperer 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page