Turn raw data into compelling business narratives automatically.
DataStory analyzes your datasets and generates full written reports with insights, trends, and recommendations - no LLMs needed, pure Python intelligence.
- Dashboards don't explain insights - They show graphs, not stories
- People want narratives - Business stakeholders need context, not just charts
- Manual analysis takes time - Writing reports is tedious and repetitive
- Insights get lost - Important patterns buried in spreadsheets
DataStory automatically:
- β Analyzes your data for trends, patterns, and anomalies
- β Generates natural language business narratives
- β Identifies risks and opportunities
- β Provides actionable recommendations
- β Exports to text, markdown, HTML, or PDF
All with a single line of code!
pip install datastoryFor full features (charts, Excel, PDF):
pip install datastory[full]from datastory import narrate
report = narrate("sales.csv")
print(report)Output:
π EXECUTIVE SUMMARY
==================================================
Analyzed 1,247 records across 8 dimensions.
π‘ 3 high-priority insights identified.
Key Highlights:
1. Sales increased by 12.3% from $450,000 to $505,000.
2. Customer churn rose in April by 8.5%, requiring attention.
3. West Africa region dominates sales, accounting for 45.2% of revenue.
π KEY FINDINGS
==================================================
**Performance Trends:**
β’ Sales Shows Strong Growth: Sales increased by 12.3% from $450,000 to $505,000.
β’ Revenue per Customer Rising: Average order value grew by 15.7%.
**Notable Anomalies:**
β’ Unusual Values Detected in Order Quantity: Found 23 outliers (1.8% of data).
**Relationships Discovered:**
β’ Strong Positive Link: Marketing Spend and Revenue move together (correlation: 0.85).
π DETAILED ANALYSIS
==================================================
**High-Priority Insights:**
π‘ Customer Churn Rising
Customer churn increased by 8.5% in April. This represents a significant concern.
π‘ Low Stock Risk: Product X
Minimum inventory is 12 units, significantly below average of 150. Consider restocking.
π‘ RECOMMENDATIONS
==================================================
1. Investigate the decline in customer retention and implement recovery strategies
2. Capitalize on the growth in revenue per customer to maximize returns
3. Replenish product_x inventory to avoid stockouts
4. Review outliers in order quantity to identify root causes
5. Leverage identified relationships between metrics for predictive insights
==================================================
Report generated on December 03, 2025 at 1:20 PM
Powered by DataStory - Automatic Storytelling from Data
- No LLMs or AI APIs required
- Works offline
- Fast and deterministic
- Zero-cost analysis
- Statistical summaries
- Trend detection
- Anomaly identification
- Correlation discovery
- Time series patterns
- Risk assessment
- Business-friendly narratives
- Context-aware descriptions
- Action-oriented recommendations
- Multiple detail levels
from datastory import DataStory
story = DataStory()
story.load("data.csv")
# Export to different formats
story.export("report.txt", format="text")
story.export("report.md", format="markdown")
story.export("report.html", format="html", include_charts=True)
story.export("report.pdf", format="pdf")# CSV, Excel, JSON, Parquet
story.load("sales.csv")
story.load("data.xlsx")
story.load("records.json")
story.load("dataset.parquet")
# URLs
story.load("https://example.com/data.csv")
# Pandas DataFrames
import pandas as pd
df = pd.read_sql("SELECT * FROM sales", conn)
story.load(df)from datastory import DataStory
# Configure narrative style
config = {
"style": "business", # business, casual, technical
"detail_level": "detailed", # brief, medium, detailed
"include_recommendations": True
}
story = DataStory(config=config)
story.load("sales.csv")
narrative = story.generate_narrative()
print(narrative)# Access insights directly
story = DataStory()
story.load("data.csv")
insights = story.extract_insights()
for insight in insights:
print(f"{insight.type}: {insight.title}")
print(f"Priority: {insight.priority}")
print(f"Description: {insight.description}\n")# Get raw analysis results
story = DataStory()
story.load("data.csv")
results = story.analyze()
print(results["trends"])
print(results["anomalies"])
print(results["correlations"])Generate executive summaries from sales, marketing, or financial data.
Automatically document exploratory data analysis (EDA) findings.
Create daily/weekly reports on KPIs and metrics.
Transform raw analytics into client-ready narratives.
Quickly summarize dataset characteristics and patterns.
| Feature | DataStory | Traditional BI | LLM-based |
|---|---|---|---|
| Setup Time | Instant | Hours/Days | API setup |
| Cost | Free | $$$$ | $$$ per call |
| Offline Use | β Yes | β No | β No |
| Customizable | β Full control | β Black box | |
| Speed | β‘ Instant | π Slow | β³ API delays |
| Privacy | π Local | β Sent to API | |
| Deterministic | β Yes | β Yes | β No |
The examples/ directory includes sample datasets:
sales.csv- Sales performance datacustomer_churn.csv- Customer retention datainventory.csv- Stock levels and products
- Core Analyzer: Statistical analysis using pandas/numpy
- Insight Extractor: Pattern recognition and business logic
- Narrative Generator: Template-based natural language generation
- Data Loaders: Multi-format support (CSV, Excel, JSON, Parquet)
- Report Formatters: Export to text, markdown, HTML, PDF
- Core:
pandas,numpy - Optional:
matplotlib(charts),openpyxl(Excel),reportlab(PDF)
- Analyzes 100K rows in <2 seconds
- Generates narrative in <1 second
- Low memory footprint
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License - see LICENSE file for details.
Built with β€οΈ by Idriss Bado
Inspired by the need for better data communication in business.
- GitHub: @idrissbado
- PyPI: datastory
β Star this repo if you find it useful!
π Found a bug? Open an issue
π‘ Have an idea? Start a discussion