Skip to main content

DataForgeX: Prep • Plot • Evaluate • Detect

Project description

🚀 DataForgeX – Code Reduction Examples

This document shows how DataForgeX (DFX) reduces long and repetitive data science code into simple and readable one-liners.


1. Handling Missing Values

Without DataForgeX

import pandas as pd

for col in df.columns:
    if df[col].dtype == "object":
        df[col] = df[col].fillna(df[col].mode()[0])
    else:
        df[col] = df[col].fillna(df[col].median())

With DataForgeX

from dfx import handle_missing_values
df = handle_missing_values(df)

Code reduced: ~10 lines → 1 line


2. Fixing Data Types Automatically

Without DataForgeX

df["age"] = pd.to_numeric(df["age"], errors="coerce")
df["date"] = pd.to_datetime(df["date"], errors="coerce")
df["flag"] = df["flag"].map({"yes": 1, "no": 0})

With DataForgeX

from dfx import auto_fix_dtypes
df = auto_fix_dtypes(df)

4. Outlier Handling

Without DataForgeX

Q1 = df["chol"].quantile(0.25)
Q3 = df["chol"].quantile(0.75)
IQR = Q3 - Q1

df = df[
    (df["chol"] >= Q1 - 1.5 * IQR) &
    (df["chol"] <= Q3 + 1.5 * IQR)
]

With DataForgeX

from dfx import remove_outliers
df = remove_outliers(df)

5. Encoding Categorical Features

Without DataForgeX

from sklearn.preprocessing import LabelEncoder

le = LabelEncoder()
df["sex"] = le.fit_transform(df["sex"])
df = pd.get_dummies(df, columns=["cp"], drop_first=True)

With DataForgeX

from dfx import auto_encode
df = auto_encode(df)

6. Feature Scaling

Without DataForgeX

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
df[cols] = scaler.fit_transform(df[cols])

With DataForgeX

from dfx import scale_data
df = scale_data(df)

7. Model Evaluation

Without DataForgeX

from sklearn.metrics import accuracy_score, classification_report

y_pred = model.predict(X_test)
print(accuracy_score(y_test, y_pred))
print(classification_report(y_test, y_pred))

With DataForgeX

from dfx import evaluate_classification
evaluate_classification(model, X_test, y_test)

8. Full Workflow Comparison

Without DataForgeX

df = fix_types(df)
df = fill_missing(df)
plot_all(df)
df = encode(df)
df = scale(df)
evaluate(model)

With DataForgeX

from dfx import auto_fix_dtypes, handle_missing_values, quick_eda
from dfx import auto_encode, scale_data, evaluate_model

df = auto_fix_dtypes(df)
df = handle_missing_values(df)
quick_eda(df)
df = auto_encode(df)
df = scale_data(df)
evaluate_model(model, X_test, y_test)

📦 Installation

Install the latest stable version from PyPI:

pip install dfx

Install with optional ML features:

pip install dfx[ml]

Install development tools:

pip install dfx[dev]

🚀 Quick Start

import pandas as pd
from dfx import (
    auto_fix_dtypes,
    handle_missing_values,
    auto_encode,
    scale_data,
    evaluate_classification
)

# Load data
df = pd.read_csv("data.csv")

# Preprocess
df = auto_fix_dtypes(df)
df = handle_missing_values(df)
df = auto_encode(df)
df = scale_data(df)

# Train model
from sklearn.ensemble import RandomForestClassifier

X = df.drop("target", axis=1)
y = df["target"]

model = RandomForestClassifier().fit(X, y)

# Evaluate
evaluate_classification(model, X, y)

🧠 Core Features

Feature Description
Automatic dtype fixing Detects numeric, date, and boolean columns
Missing value handling Smart median/mode imputation
Auto encoding Label + one-hot encoding
Scaling Standard/robust scaling
Outlier removal IQR-based filtering
Quick EDA Summary + plots
Model evaluation Metrics + reports

🏗️ Library Design

DataForgeX follows three design principles:

  • Automation — minimal user code
  • Consistency — standardized preprocessing
  • Compatibility — works with pandas & sklearn

It integrates directly into existing ML pipelines without replacing them.


📊 Typical Workflow

Raw Data
   ↓
DataForgeX Preprocessing
   ↓
Clean Dataset
   ↓
Model Training
   ↓
Evaluation

📁 Project Structure

DataForgeX/
│
├── pyproject.toml
├── README.md
├── LICENSE
│
└── src/
    └── dfx/
        ├── preprocessing.py
        ├── encoding.py
        ├── scaling.py
        ├── outliers.py
        ├── eda.py
        └── evaluation.py

🎯 Use Cases

DataForgeX is useful for:

  • Machine learning preprocessing
  • Kaggle competitions
  • Research experiments
  • Student projects
  • Rapid prototyping
  • Data cleaning automation

🤝 Contributing

Contributions are welcome.

  1. Fork repository
  2. Create feature branch
  3. Commit changes
  4. Submit pull request

Final Summary

  • Less code
  • Better readability
  • Faster development
  • Reusable functions

DataForgeX lets you focus on logic, not boilerplate.


Authors and Contributors

Author and Lead Developer

Prince Saxena
Creator and primary developer of DataForgeX.
Responsible for the design, architecture, and implementation of the library.

Contributors

The development of DataForgeX benefited from valuable collaboration and input from:

  • Mohd Saad Sherwani — Conceptual discussions and feature ideation
  • Hammad Rafeeque — Testing, feedback, and usability evaluation

Their support and insights helped refine the direction and usability of the project.


📜 License

MIT License © 2026 Prince Saxena

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

dataforgex-0.1.3.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

dataforgex-0.1.3-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file dataforgex-0.1.3.tar.gz.

File metadata

  • Download URL: dataforgex-0.1.3.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dataforgex-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fddfab2662be91930dee0fe1456e50a2bf91a33144423303f159306d66cd769a
MD5 22b4efacbb9367f10cefb72dee087493
BLAKE2b-256 398548ea7fcd36a4394e3520cf7934d6ba0725c1e749489c20af0827b0d92f41

See more details on using hashes here.

File details

Details for the file dataforgex-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: dataforgex-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dataforgex-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54236ea8ad32cad17b7dc64d22ce6a9ac10400123e77e49894a221d01830f868
MD5 d810386cd216b8972b66bc2ff5e7aebc
BLAKE2b-256 52cba340805b56c6d6a1188f77051f6d4dae7bd1315f29872faf406a726be9f2

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