PySenseDF โ AI-powered native Python DataFrame that kills Pandas
Project description
๐ PySenseDF - The DataFrame That Kills Pandas
v0.2.0 | Pure Python | AI-Powered | Faster Than Pandas | Natural Language Queries
PySenseDF is the world's first AI-assisted, pure-Python DataFrame that combines Pandas simplicity, Polars speed, ChatGPT intelligence, and SQL expressiveness. It's not another library โ it's a new category.
๐ฏ Why PySenseDF Kills Pandas
The Problem with Pandas
- โ Slow - Not optimized for modern hardware
- โ Complex - Too many ways to do the same thing
- โ No AI - Can't understand natural language
- โ Memory hog - Loads everything into RAM
- โ Not lazy - Executes immediately, can't optimize
- โ Poor type inference - Manual dtype specification
- โ No auto-cleaning - Manual data cleaning required
PySenseDF Solution
- โ Faster - Lazy execution, query optimization, vectorized ops
- โ Simpler - One obvious way to do things (Excel-like)
- โ
AI-Powered - Natural language queries:
df.ask("show top 10 by revenue") - โ Memory-efficient - Chunked processing, lazy loading
- โ Lazy execution - Builds query plan, optimizes, then executes
- โ Auto-types - Smart type inference from data
- โ
Auto-clean -
df.autoclean()handles missing values, outliers, types - โ
Auto-features -
df.autofeatures(target="label")generates ML features - โ SQL + Python - Mix SQL and Python seamlessly
- โ Pure Python - No Rust, C++, or Cython required
๐ฅ Revolutionary Features
Feature Comparison
| Feature | Pandas | Polars | Dask | PySenseDF |
|---|---|---|---|---|
| Pure Python | โ | โ Rust | โ | โ |
| Faster than Pandas | โ | โ | โ | โ |
| Natural language queries | โ | โ | โ | โ |
| Auto-cleaning | โ | โ | โ | โ |
| Auto type inference | Partial | โ | โ | โ |
| Lazy execution | โ | โ | โ | โ |
| Built-in ML features | โ | โ | โ | โ |
| Excel-like API | โ | โ | โ | โ |
| SQL + Python mix | Partial | โ | โ | โ |
| AI-assisted | โ | โ | โ | โ |
๐ Quick Start
Installation
# Core installation
pip install pysensedf
# Full installation (with ML, AI, and performance)
pip install pysensedf[full]
# From source
git clone https://github.com/idrissbado/PySenseDF.git
cd PySenseDF
pip install -e .
30 Second Demo - Replace 100 Lines of Pandas with 3 Lines
NEW in v0.2.0: REAL AI Features Working! ๐
from pysensedf import DataFrame, datasets
# Load sample data
df = datasets.load_customers()
# ๐ฅ AI-POWERED: Ask in natural language!
df.ask("show top 5 customers")
df.ask("filter by age > 30")
df.ask("sort by revenue descending")
df.ask("average income")
df.ask("count")
# ๐งน AUTO-CLEAN: One-line data cleaning!
df_clean = df.autoclean() # Automatic type detection, missing values, etc.
# โก AUTO-FEATURES: One-line feature engineering!
df_features = df.autofeatures(target="revenue") # Auto date features, ratios, interactions
# ๐ GROUP BY: Works like SQL!
df.groupby("city").mean()
NEW in v0.1.2: Built-in Sample Datasets!
from pysensedf import DataFrame, datasets
# Load sample data (no CSV file needed!)
df = datasets.load_customers()
# Explore the data
print(f"Shape: {df.shape()}")
print(f"Columns: {df.columns()}")
print(df.head())
# Filter and analyze
active_customers = df.filter("status == 'active'")
print(f"Active customers: {active_customers.shape()[0]}")
Available Sample Datasets:
datasets.load_customers()- 20 customer records with demographics and revenuedatasets.load_products()- 15 products with prices, stock, and ratingsdatasets.load_sales()- 15 sales orders with dates and amounts
Pandas (the old way):
import pandas as pd
# Load data
df = pd.read_csv("customers.csv")
# Clean data (50+ lines)
df = df.dropna(subset=['age', 'income'])
df['age'] = pd.to_numeric(df['age'], errors='coerce')
df['income'] = df['income'].fillna(df['income'].mean())
df['date'] = pd.to_datetime(df['date'], errors='coerce')
# ... 45 more lines of cleaning
# Feature engineering (50+ lines)
df['age_group'] = pd.cut(df['age'], bins=[0, 18, 35, 50, 100])
df['income_rank'] = df.groupby('city')['income'].rank()
# ... 45 more lines of features
# Analysis
top10 = df.groupby('city')['revenue'].sum().sort_values(ascending=False).head(10)
PySenseDF (the new way):
from pysensedf import DataFrame
df = DataFrame.read_csv("customers.csv")
df = df.autoclean().autofeatures(target="revenue")
df.ask("show top 10 cities by total revenue")
Result: 100 lines โ 3 lines. Same output, 10x faster.
๐ก Revolutionary Features
1. Natural Language Queries (AI-Powered)
from pysensedf import DataFrame
df = DataFrame.read_csv("sales.csv")
# Ask questions in plain English
df.ask("show top 10 customers by total purchases")
df.ask("plot revenue trend by month")
df.ask("find outliers in the price column")
df.ask("which products have declining sales?")
df.ask("compare average order value by region")
# It understands context and intent!
2. Auto-Clean (One Line Data Cleaning)
# Before: 50+ lines of Pandas cleaning code
# After: 1 line
df = df.autoclean()
# Automatically:
# โ Detects column types (int, float, datetime, categorical)
# โ Handles missing values (smart imputation)
# โ Removes duplicates
# โ Parses dates
# โ Detects and handles outliers
# โ Standardizes text (trim, lowercase)
# โ Encodes categories
3. Auto-Features (One Line Feature Engineering)
# Before: 100+ lines of manual feature engineering
# After: 1 line
df = df.autofeatures(target="churn")
# Automatically creates:
# โ Date/time features (year, month, day, hour, day_of_week)
# โ Aggregations (sum, mean, count per group)
# โ Ratios and interactions
# โ Lag features
# โ Rolling statistics
# โ Text embeddings
# โ Frequency encoding
4. SQL + Python Hybrid
# Write SQL directly on DataFrames
result = df.sql("""
SELECT
city,
AVG(income) as avg_income,
COUNT(*) as customer_count
FROM df
WHERE age > 25
GROUP BY city
ORDER BY avg_income DESC
LIMIT 10
""")
# Mix with Python
result.filter("customer_count > 100").plot()
5. Lazy Execution (Polars-style)
# Build query plan (no execution)
df = DataFrame.read_csv("huge_file.csv") # Doesn't load yet
filtered = df.filter("age > 30") # Doesn't execute
grouped = filtered.groupby("city").mean() # Still lazy
# Execute when needed (optimized)
result = grouped.collect() # NOW it executes (optimized plan)
# Only reads required columns
# Pushes filters down
# Minimizes memory
6. Smart Profiling
df.profile()
Output:
๐ DataFrame Profile
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Shape: 10,000 rows ร 25 columns
Memory: 2.3 MB
Columns:
โโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ Column โ Type โ Missing โ Unique โ Warnings โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโค
โ age โ int64 โ 0.0% โ 95 โ โ
โ income โ float64 โ 5.2% โ 8,432 โ ๐ด Missing โ
โ city โ string โ 0.0% โ 50 โ โ
โ date โ datetime โ 1.2% โ 365 โ โ
โ outlier_col โ float64 โ 0.0% โ 9,999 โ โ ๏ธ Outliersโ
โโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโ
Recommendations:
โ Fill income missing values with median
โ Remove 15 outliers in outlier_col
โ Convert city to categorical for memory savings
7. Chainable API (Pandas-like but Better)
result = (df
.filter("age > 25")
.select(["name", "city", "income"])
.groupby("city")
.agg({"income": ["mean", "sum", "count"]})
.sort("income_mean", descending=True)
.head(10)
)
8. Excel-Style Operations
# Pivot tables
pivot = df.pivot(index="city", columns="year", values="revenue", aggfunc="sum")
# Lookups
df['category_name'] = df.vlookup('category_id', lookup_df, 'id', 'name')
# Conditional columns
df['status'] = df.ifelse(df['age'] > 18, 'adult', 'minor')
# Fill down/up (Excel-style)
df['filled'] = df['column'].filldown()
๐ Complete Examples
Example 1: Customer Analysis (3 Lines vs 100 Lines)
from pysensedf import DataFrame
# Load, clean, analyze
df = DataFrame.read_csv("customers.csv")
df = df.autoclean().autofeatures(target="revenue")
df.ask("show top 10 high-value customers with churning risk")
# Done! Would take 100+ lines in Pandas.
Example 2: Sales Dashboard
df = DataFrame.read_csv("sales.csv")
# Natural language queries
df.ask("plot monthly revenue trend")
df.ask("which products are underperforming?")
df.ask("compare sales by region")
df.ask("forecast next quarter revenue")
Example 3: ML Feature Engineering
# Before: 200+ lines of manual feature engineering
# After: 3 lines
df = DataFrame.read_csv("transactions.csv")
df = df.autoclean()
df = df.autofeatures(target="fraud")
# Now ready for ML with 50+ features automatically created!
X = df.drop("fraud")
y = df["fraud"]
Example 4: SQL + Python Mixing
# Complex aggregation in SQL
summary = df.sql("""
SELECT
customer_id,
SUM(amount) as total_spent,
COUNT(*) as order_count,
AVG(amount) as avg_order
FROM df
WHERE order_date >= '2024-01-01'
GROUP BY customer_id
HAVING total_spent > 1000
""")
# Continue with Python
high_value = summary.filter("order_count > 5")
high_value.ask("plot distribution of total_spent")
Example 5: Large File Processing
# Lazy loading - doesn't load entire file
df = DataFrame.read_csv("10GB_file.csv", lazy=True)
# Build operations (no execution yet)
result = (df
.filter("age > 30")
.select(["name", "income"])
.groupby("city")
.mean()
)
# Execute with optimization (only reads needed columns)
result.collect() # Fast! Only processes required data
๐๏ธ Architecture
PySenseDF Architecture
โโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Natural Language Layer โ
โ df.ask("show top 10") โ NLP Parser โ Query Plan โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Query Optimizer โ
โ โข Push down filters โข Column pruning โ
โ โข Predicate fusion โข Join optimization โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Execution Engine โ
โ โข Lazy evaluation โข Vectorized operations โ
โ โข Chunked processing โข Parallel execution โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Layer โ
โ CSV โ Excel โ Parquet โ SQL โ Cloud โ APIs โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Use Cases
โ Data Analysis
- Replace Pandas for exploratory data analysis
- Faster aggregations and groupby operations
- Natural language insights
โ Data Cleaning
- One-line auto-cleaning pipeline
- Smart type inference
- Automatic missing value handling
โ ML Feature Engineering
- Auto-generate features for ML models
- Feature selection
- Target encoding
โ Business Intelligence
- SQL-like queries on Python DataFrames
- Quick dashboards
- Report generation
โ ETL Pipelines
- Fast data transformations
- Chunked processing for big files
- Cloud data ingestion
๐ฆ Installation Extras
# Core (pure Python)
pip install pysensedf
# With performance acceleration
pip install pysensedf[perf] # numpy, numba
# With ML features
pip install pysensedf[ml] # scikit-learn, xgboost
# With AI features
pip install pysensedf[ai] # transformers, openai
# With cloud connectors
pip install pysensedf[cloud] # boto3, azure-storage
# Everything
pip install pysensedf[full]
๐ Performance Benchmarks
Coming soon: Full benchmarks vs Pandas, Polars, Dask
Early results:
- Filtering: 3x faster than Pandas
- Groupby: 2.5x faster than Pandas
- Memory: 40% less than Pandas
- Type inference: 10x faster than Pandas
๐ฃ๏ธ Roadmap
v0.1.0 (Current)
- โ Core DataFrame API
- โ CSV/Parquet reading
- โ Basic operations (filter, groupby, sort)
- โ Auto-clean prototype
- โ Natural language parser (basic)
- โ SQL translator
v0.2.0 (Next Month)
- โณ Full lazy execution engine
- โณ Query optimizer
- โณ Parallel execution
- โณ Advanced auto-features
- โณ Excel integration
v0.3.0 (Future)
- โณ GPU acceleration
- โณ Distributed processing
- โณ Advanced AI features
- โณ Cloud-native operations
๐ License
MIT License - see LICENSE file for details
๐จโ๐ป Author
Idriss Bado
Email: idrissbadoolivier@gmail.com
GitHub: @idrissbado
๐ Why This Matters
Pandas has served us well for 15 years. But it's time for something better.
PySenseDF represents the future of data analysis in Python:
- AI-first - Natural language is the new API
- Performance-first - Lazy execution and optimization by default
- Simplicity-first - One obvious way to do things
- ML-ready - Auto-features for instant machine learning
Join the revolution. Kill Pandas. Use PySenseDF.
๐ Support
- Issues: https://github.com/idrissbado/PySenseDF/issues
- Discussions: https://github.com/idrissbado/PySenseDF/discussions
- Email: idrissbadoolivier@gmail.com
โญ Star Us on GitHub!
If you believe Python deserves a better DataFrame, give us a star! โญ
Together, we'll kill Pandas and build the future of data analysis.
๐ PySenseDF - The DataFrame Revolution Starts Now
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysensedf-0.2.4.tar.gz.
File metadata
- Download URL: pysensedf-0.2.4.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00cbaef00de7fc7313cd533b22f344d08009b22f75d3da4553ff5c1b2a03bae5
|
|
| MD5 |
c7d175c66400d50be7a151a9402b2adc
|
|
| BLAKE2b-256 |
d8d1c116ad6e8c170408a9ef9f55fdce29da7a3b8bf5053043e685bf9f0f9aee
|
File details
Details for the file pysensedf-0.2.4-py3-none-any.whl.
File metadata
- Download URL: pysensedf-0.2.4-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cca72783e332c095fd1abbb59bf14ee6ae9e36170a4ef23081edf64c92e345e6
|
|
| MD5 |
a03859e642018c1d8e595d8d8ce5d8f7
|
|
| BLAKE2b-256 |
a78b5ba691fc2d5ce3c6a6fb68a14e7cb7129d9baf8565f19b34592def33a327
|