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.2.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.2-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dataforgex-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 719cc6e9a7f76622e4a7ebcaf3c9a4a3300beb84d4e8fe4e09f84162e8e2415d
MD5 d1048cb59f6e4bb273e1224b1085018d
BLAKE2b-256 e5a495a6bd1e4d19ec00dbff73ff137000da38ef4a4f647edd31d84f516ccdb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dataforgex-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1f14f3e8a016727311d70c14bed104779693b8c9aa0c7314f250e773a1af00
MD5 3009efa5b30b77e073214ee8cff3a447
BLAKE2b-256 c97044e2549ebafbaf7ffc9908257ee0a7597a9ce0c62911a026edca6dd7deb7

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