Skip to main content

ForgeKit

ForgeKit is a Python package designed to simplify data manipulation, visualization, and basic machine learning tasks. Whether you're cleaning, transforming, or visualizing your data, ForgeKit provides an intuitive interface to make these processes faster and more efficient.

Features

  • Data Display & Summarization: Easily display and summarize DataFrames.
  • Data Cleaning & Transformation: Handle missing data, remove outliers, scale data, and more.
  • Visualization: Create static and interactive plots using Matplotlib and Plotly.
  • Machine Learning Utilities: Perform K-Means clustering, evaluate feature importance, and split data into training and test sets.
  • Reporting: Generate markdown reports from DataFrames.

Installation

Install the package using pip:

pip install forgekit

For detailed setup instructions, see INSTALL.md.

Usage

Here's a simple example of ForgeKit in action. For a more comprehensive step-by-step workflow, refer to the examples.py file.

import pandas as pd
import forgekit as fk

# Sample Data
data = {
    'A': [5, 8, 10, 15, 20],
    'B': [10, 20, 15, 10, 5],
    'C': ['red', 'blue', 'green', 'red', 'blue']
}
df = pd.DataFrame(data)

# Display DataFrame
fk.display_dataframe(df)

# Plot DataFrame
fk.plot_dataframe(df[['A', 'B']], kind='line', title="Sample Data Plot")

# Perform K-Means Clustering
df_clustered = fk.kmeans_clustering(df[['A', 'B']], n_clusters=2)
fk.display_dataframe(df_clustered)

# Generate a Markdown Report
fk.generate_report(df, file_name='report.md')

For more usage examples, see the examples.py file in the root directory, which includes:

  • Data normalization and plotting
  • Handling missing values
  • K-Means clustering and more

Key Functions in forgekit

Here is an overview of the most commonly used functions in ForgeKit:

Data Display & Summarization

  • display_dataframe(dataframe, max_rows=10): Display a DataFrame with customizable row limits.
  • summary_stats(dataframe): Generate descriptive statistics for numerical columns.
  • custom_summary(dataframe): Display data types, missing values, and descriptive statistics in one output.

Data Cleaning

  • impute_missing_data(dataframe, strategy='mean'): Impute missing values using strategies like mean, median, or mode.
  • remove_outliers(dataframe, columns): Remove outliers from specified numerical columns using the IQR method.
  • remove_duplicates(dataframe): Remove duplicate rows from a DataFrame.
  • clean_text_columns(dataframe, columns): Clean text columns by removing whitespace and standardizing case.

Data Transformation

  • minmax_scale(dataframe): Scale numerical data between 0 and 1.
  • standard_scale(dataframe): Standardize numerical data to have a mean of 0 and unit variance.
  • log_transform(dataframe, columns): Apply log transformations to reduce skewness in the data.
  • one_hot_encode(dataframe, columns): Perform one-hot encoding on categorical columns.

Data Visualization

  • plot_dataframe(dataframe, kind='line', title): Generate static plots (e.g., line, bar, scatter) using Matplotlib.
  • interactive_plot(dataframe, x_col, y_col, kind='scatter', title): Create interactive plots using Plotly.

Machine Learning Utilities

  • kmeans_clustering(dataframe, n_clusters=3): Perform K-Means clustering and add cluster labels to the DataFrame.
  • train_test_split_data(dataframe, target_column, test_size=0.2): Split data into training and test sets.
  • feature_importance(dataframe, target_column): Calculate feature importance using a RandomForest classifier.

Reporting & Export

  • generate_report(dataframe, file_name='report.md'): Generate a markdown report of the DataFrame with descriptive statistics.
  • export_csv(dataframe, file_name): Export a DataFrame to a CSV file.
  • load_csv(file_path): Load a CSV file into a DataFrame.

Example Workflow

Here’s a brief example showing how you might use ForgeKit in a typical data analysis workflow. For the full script, check out the [examples.py](https://github.com/0xMarcio/forgekit/blob/main/ examples.py) file.

import pandas as pd
import forgekit as fk

# Step 1: Load data
df = pd.DataFrame({
    'A': [5, 8, 10, 15, 20],
    'B': [10, 20, 15, 10, 5],
    'C': ['red', 'blue', 'green', 'red', 'blue']
})

# Step 2: Display the DataFrame
fk.display_dataframe(df)

# Step 3: Summary statistics
fk.summary_stats(df)

# Step 4: Normalize numerical columns
df_normalized = fk.minmax_scale(df[['A', 'B']])

# Step 5: K-Means Clustering
df_clustered = fk.kmeans_clustering(df[['A', 'B']], n_clusters=2)

# Step 6: Plot results
fk.plot_dataframe(df_normalized, kind='line', title="Normalized Data")

# Step 7: Generate a markdown report
fk.generate_report(df, file_name='report.md')

This workflow demonstrates the ease of use of ForgeKit for quickly loading, transforming, visualizing, and analyzing data.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

We welcome contributions! Please feel free to open issues or pull requests if you'd like to add features, fix bugs, or improve documentation.

Metadata

Release files for forgekit 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forgekit 1.0.6
File Size Uploaded
forgekit-1.0.6.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forgekit 1.0.6
File Interpreter ABI Platform
forgekit-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / forgekit-1.0.6.tar.gz

Download URL forgekit-1.0.6.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
af87e1104f271baf2ec2cefba2dda003048d906811517f2316cc9f9c1ef9f15a
BLAKE2b-256 checksum
How to use checksums
5e0890963a9d33cdbb2937ecfaf81d7ec2e437460eeb6e84661f4096b1b36214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / forgekit-1.0.6-py3-none-any.whl

Download URL forgekit-1.0.6-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eabb57dd178e54b74117187831c987669e1be3ffaf53c6dd21608617e65d510e
BLAKE2b-256 checksum
How to use checksums
c05fbc33753513e84753c0dc26ec549f51fcd07f0bb9703f4b56cacd3e694ebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page