Skip to main content

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


Download files

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

Source Distribution

dfflow-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

dfflow-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for dfflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca26c9de7955e99db0e63c5da704194a41f970effd9b8e21b4c125490361d9b7
MD5 476336eecc743d698e81756f6c3c0497
BLAKE2b-256 7fc61e1e882fd6b402d5fef637419ee62bfe74e5eefcfbd5290eaa75b31add89

See more details on using hashes here.

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

Hashes for dfflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 849bef0e2616be76bb541338c7ac7fc1110bfa19644b0c691ea71d4846754b73
MD5 cd10bd2a04266ad0e4b146d7e6defacb
BLAKE2b-256 6cbf56bc5dd036d8d22daca1835d965b34d1cff56ccd9e0ab07e207841eff5bb

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