Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wlibrary-1.1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wlibrary-1.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file wlibrary-1.1.0.tar.gz.

File metadata

  • Download URL: wlibrary-1.1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wlibrary-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bed62c3804d268fc65c06a26ef44f0903bfe3ff62d95372b145937ec2d359718
MD5 ace81740da36427f2fb9412f6db2af15
BLAKE2b-256 c0f69009d71fa5c92f3163e2990552300771d2b8cb691e681338cfffadad2d97

See more details on using hashes here.

File details

Details for the file wlibrary-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: wlibrary-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wlibrary-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3eca457ffd32a36e815052aea9639a72ab323d5eec2bd9479cdeaa2ba549dab1
MD5 eb22e460557469c059c8cb4699cc4e7d
BLAKE2b-256 37360fd11fa6a998d8001fc40de5ceb80cd754ee1dfe787ec6b63f75fed6fa27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page