Lightweight pandas DataFrame logging and flow tracker
Project description
dfflow
Lightweight pandas DataFrame logging and flow pipeline tracker.
๐ What is this?
dfflow is a simple, easy-to-use Python package for:
- Logging pandas DataFrame transformations step by step
- Saving logs in text or JSON format
- Building reusable pipeline-style data flows
๐ Features
โ
Automatic DataFrame transformation logging
โ
Text and JSON log formats supported
โ
Easy pipeline-style processing
โ
Customizable logging
๐ Installation
pip install dfflow
๐ Requirements
- Python >=3.7
- pandas >=1.3
To install requirements:
pip install -r requirements.txt
๐ Usage Example 1
import pandas as pd
from dfflow import DFLogger, FlowPipeline, drop_nulls
import os
os.makedirs('examples', exist_ok=True)
logger = DFLogger()
pipe = FlowPipeline(logger=logger)
pipe.add_step("Drop Nulls", drop_nulls)
df = pd.DataFrame({
'name': ['Suresh', None, 'Jerry', 'Sunil', 'Linga'],
'age': [23, 26, None, 23, 24]
})
pipe.run(df)
๐ Usage Example 2
import pandas as pd
from dfflow import DFLogger, FlowPipeline
from dfflow.cleaning import drop_nulls, lowercase_columns
from dfflow.profile import profile_summary
# Create a sample DataFrame
data = {
"Name": ["Suresh", None, "Sunil", "Shiva", "Linga"],
"Age": [23, 26, 23, 24, None]
}
df = pd.DataFrame(data)
print("Original DataFrame:")
print(df)
print("\n")
# Setup the DFLogger
logger = DFLogger(
log_file='dfflow_log2.txt', # Log file path
mode='text' # 'text' or 'json'
)
# Create the FlowPipeline
pipe = FlowPipeline(logger=logger)
# Add cleaning steps
pipe.add_step("Drop Nulls", drop_nulls)
pipe.add_step("Lowercase Columns", lowercase_columns)
# Run the pipeline
result_df = pipe.run(df)
print("Final Cleaned DataFrame:")
print(result_df)
print("\n")
# Profile Summary
summary = profile_summary(result_df)
print("Profile Summary:")
print(summary)
๐ Project Structure
dfflow/ # Main package folder
โ
โโโ __init__.py
โโโ logger.py # Core logging class (DFLogger)
โโโ decorators.py # log_step decorator
โโโ flow.py # FlowPipeline logic
โโโ cleaning.py # Cleaning steps (drop_nulls, lowercase_columns)
โโโ profile.py # Profile utilities
โโโ utils.py # Helper functions
โ
examples/ # Usage demos
โ โโโ dfflow_log.txt
โ โโโ dfflow_log2.txt
โ โโโ flow_demo.py
โ โโโ flow_demo2.py
โ
tests/ # Unit tests
โ โโโ __init__.py
โ โโโ test_cleaning.py
โ โโโ test_flow.py
โ โโโ test_logger.py
โ โโโ test_profile.py
โ
LICENSE # MIT License
README.md # Project description
requirements.txt # Dependencies
setup.py # Packaging configuration
๐ Author
Maintained by Suresh K
๐ง Email: sureshstr38@gmail.com
๐ GitHub: suressssz
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
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 dfflow-0.1.0.tar.gz.
File metadata
- Download URL: dfflow-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca26c9de7955e99db0e63c5da704194a41f970effd9b8e21b4c125490361d9b7
|
|
| MD5 |
476336eecc743d698e81756f6c3c0497
|
|
| BLAKE2b-256 |
7fc61e1e882fd6b402d5fef637419ee62bfe74e5eefcfbd5290eaa75b31add89
|
File details
Details for the file dfflow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dfflow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
849bef0e2616be76bb541338c7ac7fc1110bfa19644b0c691ea71d4846754b73
|
|
| MD5 |
cd10bd2a04266ad0e4b146d7e6defacb
|
|
| BLAKE2b-256 |
6cbf56bc5dd036d8d22daca1835d965b34d1cff56ccd9e0ab07e207841eff5bb
|