DataProcessing
A user-friendly Python package for working with CSV data. DataProcessing makes common CSV operations simple and intuitive, with smart defaults and helpful error messages.
Features
- Smart Loading: Auto-detect encoding, delimiters, and handle malformed files
- Intuitive API: Chainable methods for filtering, sorting, and data manipulation
- SQL Support: Write SQL queries directly on CSV data
- Live Data: Connect to databases, APIs, and real-time data streams
- Helpful Errors: Clear error messages instead of cryptic pandas errors
- Smart Defaults: Works out of the box with minimal configuration
- Data Exploration: Quick summaries and data profiling
Quick Start
from dataprocessing import load, save, import_live, create_live_stream
# Load CSV with smart defaults
data = load("data.csv")
# Filter and manipulate
filtered = data.where(data['age'] > 25).sort_by("name")
# Or use SQL
filtered = data.sql("SELECT * FROM data WHERE age > 25 ORDER BY name")
# Load from database
from dataprocessing import load_from_db
db_data = load_from_db('postgresql', 'postgresql://user:pass@localhost/db', 'SELECT * FROM users')
# Load from API
from dataprocessing import load_from_api
api_data = load_from_api('https://api.example.com', '/data')
# Simple live data import
data = import_live("@https://example.com/live-data.csv")
live_data = create_live_stream(data, interval=60)
results = live_data.sql("SELECT * FROM data LIMIT 10")
# Save with automatic formatting
filtered.save("output.csv")
Installation
pip install dataprocessing
For faster performance with large datasets:
pip install dataprocessing[fast]
Basic Usage
Loading Data
from dataprocessing import load
# Simple loading with auto-detection
data = load("data.csv")
# With custom options
data = load("data.csv", encoding="utf-8", delimiter=";")
Data Manipulation
# Filtering
young_users = data.where(data['age'] < 30)
active_users = data.where(data['status'] == "active")
# Sorting
sorted_data = data.sort_by("name")
sorted_data = data.sort_by("age", ascending=False)
# Column operations
data = data.rename_column("old_name", "new_name")
data = data.select_columns(["name", "age", "email"])
data = data.drop_columns(["unused_column"])
# Adding columns
data = data.add_column("full_name", data["first_name"] + " " + data["last_name"])
Data Exploration
# Quick summary
print(data.summary())
# Data profiling
print(data.profile())
# Preview data
print(data.head())
print(data.tail())
print(data.sample(5))
SQL Support
# Basic queries
result = data.sql("SELECT * FROM data WHERE age > 25")
# Aggregations
summary = data.sql("SELECT COUNT(*) as count, AVG(age) as avg_age FROM data")
# Group by
grouped = data.sql("SELECT city, COUNT(*) as count FROM data GROUP BY city")
# Complex queries
complex_result = data.sql("""
SELECT
city,
COUNT(*) as total_users,
AVG(age) as avg_age,
MAX(salary) as max_salary
FROM data
WHERE age > 25
GROUP BY city
HAVING COUNT(*) > 1
ORDER BY avg_age DESC
""")
Live Data Connections
from dataprocessing import load_from_db, load_from_api, create_live_stream
# Database connections
data = load_from_db('postgresql', 'postgresql://user:pass@localhost/db', 'SELECT * FROM users')
# API connections
data = load_from_api('https://api.example.com', '/users', headers={'Authorization': 'Bearer token'})
# Real-time data streams
def get_sensor_data():
return {'temperature': 25.5, 'humidity': 60}
stream = create_live_stream(get_sensor_data, interval=1.0)
stream.start()
data = CSVData(stream.get_latest_data())
Simple Live Data Import
from dataprocessing import import_live, create_live_stream
# Super simple syntax
data = import_live("@https://example.com/live-data.csv")
live_data = create_live_stream(data, interval=60)
print(live_data.header)
results = live_data.sql("SELECT * FROM data LIMIT 10")
print(results)
Chaining Operations
result = (load("data.csv")
.where(data['age'] > 18)
.where(data['status'] == "active")
.sort_by("name")
.select_columns(["name", "email", "age"])
.save("filtered_data.csv"))
Data Validation
# Validate data types
data = data.validate_types({
"age": "int",
"email": "email",
"date": "date"
})
# Check for missing values
missing_report = data.check_missing()
Data Cleaning
# Handle missing values
data = data.fill_missing("age", 0)
data = data.drop_missing(["email"])
# Remove duplicates
data = data.drop_duplicates()
Error Handling
DataProcessing provides helpful error messages:
# Instead of: KeyError: 'age'
# You get: Column 'age' not found. Did you mean 'Age'?
# Instead of: UnicodeDecodeError
# You get: Unable to read file encoding. Try specifying encoding='utf-8'
Performance
For large datasets, use the fast backend:
from dataprocessing import load
# Uses Polars for faster performance
data = load("large_file.csv", backend="polars")
Examples
Check out the examples/ directory for comprehensive usage examples:
basic_usage.py- Basic CSV operationsadvanced_usage.py- Advanced data manipulationsql_usage.py- SQL query exampleslive_data_usage.py- Database and API connectionssimple_live_usage.py- Simple live data import
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for dataprocesslite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dataprocesslite-0.1.0.tar.gz | 27.7 kB | Without provenance | Details for dataprocesslite-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataprocesslite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dataprocesslite-0.1.0-py3-none-any.whl |
Total release size: 55.9 kB
Release files / dataprocesslite-0.1.0.tar.gz
| Download URL | dataprocesslite-0.1.0.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd11a9572706933774435115e08dbf536d28e296640d52c275b2bc6026fc41eb
|
|
BLAKE2b-256 checksum How to use checksums |
abfcdbd947f8b02e9e0c285e477b8861ed0d3d1bfd4a77762c6501e855535eb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / dataprocesslite-0.1.0-py3-none-any.whl
| Download URL | dataprocesslite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d547136c39748a59198c677b25acad48cdece9e0db7f9a0effff21605e4c026
|
|
BLAKE2b-256 checksum How to use checksums |
20d7fd486b8d7f7be0dab61d2dacbee3b0287a618ef38f5a5065ed915229dcb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for dataprocesslite 0.1.0
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.