Python library for intelligent Excel file processing with automatic data cleaning and type detection
Project description
wlibrary
Python library for intelligent Excel file processing with automatic data cleaning and type detection.
import wlibrary as w
df = w.read("data.xlsx")
df = w.clean(df)
w.save(df, "clean.json")
Installation
pip install wlibrary
Quick Start
import wlibrary as w
# Read Excel file
df = w.read("file.xlsx")
# Clean and normalize data
df = w.clean(df)
# Save to any format
w.save(df, "output.json")
Features
- Smart Reading: Automatically handles merged cells and complex structures
- Extended Type Detection: Detects emails, phone numbers, URLs, currency, coordinates, and more
- Quality Analysis: Provides quality scores and identifies data issues
- Auto-Cleaning: Normalizes column names, removes empty rows, cleans whitespace
- Fast Performance: 3x faster with built-in caching
- Memory Efficient: 30% memory reduction with automatic optimization
Core Functions
Reading Files
w.read("file.xlsx") # Read Excel file with caching
w.sheets("file.xlsx") # Get list of sheet names
w.preview("file.xlsx", rows=10) # Preview first N rows
w.info("file.xlsx") # Get file information
Data Analysis
w.types(df, extended=True) # Detect column types
w.analyze(df) # Full structure analysis
w.suggest(df) # Get improvement suggestions
w.dups(df) # Find duplicate rows
Data Cleaning
w.clean(df) # Complete cleaning pipeline
w.normalize(df) # Normalize column names only
Exporting Data
w.save(df, "output.json") # JSON
w.save(df, "output.csv") # CSV
w.save(df, "output.xlsx") # Excel
Quick Operations
w.quick("file.xlsx") # Generate quality report
w.pipeline("file.xlsx") # Complete processing pipeline
Type Detection
Automatically detects 17+ data types:
Basic Types:
- numeric, date, categorical, text, boolean, id
Extended Types:
- email, phone, url, uuid, ipv4, currency, coordinate, postal_code, address, json
Example:
types = w.types(df, extended=True)
for col, info in types.items():
print(f"{col}: {info['type']} (confidence: {info['confidence']:.0%})")
Quality Analysis
Get comprehensive quality metrics:
info = w.analyze(df)
print(f"Quality Score: {info['quality_metrics']['score']}/100")
print(f"Completeness: {info['quality_metrics']['avg_completeness']:.0%}")
Automatically detects issues:
- Duplicate rows
- High null rates (>50% missing)
- Outliers (>3 IQR)
- Single-value columns
- Inconsistent formats
Examples
Basic Cleaning
import wlibrary as w
df = w.read("messy_data.xlsx")
df = w.clean(df)
w.save(df, "cleaned_data.xlsx")
Quality Report
import wlibrary as w
report = w.quick("data.xlsx")
print(report)
Output:
FILE: data.xlsx
Quality: 85/100
Issues: 3
- duplicates: 5 rows (5%)
- high_nulls: column1 (60%)
Suggestions:
- [HIGH] Remove duplicate rows
- [MEDIUM] Fill or remove high-null columns
Finding Specific Data
import wlibrary as w
df = w.read("contacts.xlsx")
types = w.types(df, extended=True)
# Find email columns
email_cols = [col for col, info in types.items() if info['type'] == 'email']
print(f"Email columns: {email_cols}")
Batch Processing
import wlibrary as w
from pathlib import Path
for file in Path("data").glob("*.xlsx"):
result = w.pipeline(str(file))
print(f"{file.name}: Quality {result['score']}/100")
w.save(result['df'], f"clean/{file.stem}.json")
Performance
Built-in caching makes repeat operations 3x faster:
# First read: normal speed
df = w.read("large_file.xlsx") # 2.5 seconds
# Cached read: very fast
df = w.read("large_file.xlsx") # 0.1 seconds
Memory optimization reduces usage by 30%:
df = w.read("file.xlsx", optimize=True) # Automatically downcast types
Cache Management
w.cache() # Show cache info
w.clear() # Clear cache
Configuration
Customize behavior:
from wlibrary.config import get_config, set_config
config = get_config()
config.performance.max_workers = 8
config.cleaner.empty_row_threshold = 0.7
set_config(config)
Or use a config file:
{
"performance": {
"enable_cache": true,
"max_workers": 4
},
"extended_types": {
"detect_currency": true,
"detect_email": true
}
}
from wlibrary.config import load_config
load_config("config.json")
Smart Reading
Automatically detect complex Excel structures:
structure = w.smart("complex_file.xlsx")
# Access different parts
print(structure.metadata) # {'project': 'Name', 'client': 'ACME'}
print(structure.categories) # ['Category1', 'Category2']
print(structure.table_data) # Clean DataFrame
Or just get the clean table:
df = w.smart_df("complex_file.xlsx")
Help
Built-in documentation:
import wlibrary as w
w.help()
Requirements
- Python 3.10+
- pandas
- openpyxl
- numpy
License
MIT License
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 wlibrary-1.1.1.tar.gz.
File metadata
- Download URL: wlibrary-1.1.1.tar.gz
- Upload date:
- Size: 43.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7460a6dd54c2af978d1189ff03ef39f7fcb7fb29b194a01f0c776c7a22019f
|
|
| MD5 |
5496f46e5ece974b86bec9c99dc13ce0
|
|
| BLAKE2b-256 |
8f869a6b2f1f2aa1b852203c8590b4d8ed2fd8cef1290ca79d72ffe6b38718e9
|
File details
Details for the file wlibrary-1.1.1-py3-none-any.whl.
File metadata
- Download URL: wlibrary-1.1.1-py3-none-any.whl
- Upload date:
- Size: 43.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb647fa711fff71d396beb1754faf29989a0f29a0988db47665deaa2125f0f10
|
|
| MD5 |
fcaa0fedc1753777a8301a072be64524
|
|
| BLAKE2b-256 |
fc454e30efbac7a71a136f8ccd592fe82a01028ab454b69d515667e58dcacb70
|