Skip to main content

A data preprocessor for machine learning projects.

Project description

cf_datapreprocessor

cf_datapreprocessor is a Python package that simplifies data preprocessing steps for machine learning projects. This package provides various data preprocessing tools, including handling missing values, detecting and correcting outliers, data scaling, text cleaning, encoding categorical data, and more.

Installation

To install the package, follow these steps:

pip install dataprecf
Usage
1. Handling Missing Values (missing_value_handler)
You can fill missing values with mean, median, or a constant value, or you can remove the missing data.

from dataPreprocessor.missing_value_handler import missing_value_handler

handler = missing_value_handler()

# Impute with mean
df = handler.impute_mean(df, 'column_name')

# Impute with median
df = handler.impute_median(df, 'column_name')

# Impute with a constant value
df = handler.impute_constant(df, 'column_name', value=0)

# Remove missing data
df = handler.delete_missing(df, 'column_name')
2. Handling Outliers (outlier_handler)
You can detect and remove outliers using the IQR (Interquartile Range) method.


from dataPreprocessor.outlier_handler import outlier_handler

handler = outlier_handler()
df = handler.iqr_outliers(df, 'column_name')
3. Data Scaling (scaler)
You can scale your data using Min-Max scaling or standard scaling methods.

from dataPreprocessor.scaler import scaler

scaler = scaler()

# Min-Max scaling
df = scaler.min_max_scale(df, 'column_name')

# Standard scaling
df = scaler.standard_scale(df, 'column_name')
4. Text Cleaning (text_cleaner)
You can clean text data by removing stopwords and applying lemmatization.


from dataPreprocessor.text_cleaner import text_cleaner

cleaner = text_cleaner()

# Clean a single text entry
clean_text = cleaner.clean_text("Your text data here.")

# Clean a DataFrame column
df = cleaner.clean_column(df, 'text_column')
5. Feature Engineering (feature_engineer)
You can create new features or add new columns using existing columns.


from dataPreprocessor.feature_engineer import feature_engineer

engineer = feature_engineer()

# Create a new feature
df = engineer.create_feature(df, 'new_column', lambda df: df['column1'] + df['column2'])

# Add columns
df['new_column'] = engineer.add_columns(df, 'column1', 'column2')
6. Data Type Conversion (data_type_converter)
You can convert column data types to numeric or categorical types.


from dataPreprocessor.data_type_converter import data_type_converter

converter = data_type_converter()

# Convert to numeric type
df = converter.to_numeric(df, 'column_name')

# Convert to categorical type
df = converter.to_categorical(df, 'column_name')
7. Encoding Categorical Data (categorical_encoder)
You can encode categorical data using One-Hot Encoding or Label Encoding methods.


from dataPreprocessor.categorical_encoder import categorical_encoder

encoder = categorical_encoder()

# One-Hot Encoding
df = encoder.one_hot_encode(df, 'categorical_column')

# Label Encoding
df = encoder.label_encode(df, 'categorical_column')
8. Handling Date and Time Data (datetime_handler)
You can process date and time data and extract various components.


from dataPreprocessor.datetime_handler import datetime_handler

handler = datetime_handler()

# Extract date parts
df = handler.extract_date_parts(df, 'date_column')
Requirements
You will need the following Python libraries to use this package:

pandas
numpy
scikit-learn
nltk
Contact
If you have any questions or would like to contribute, please contact:

Fatmanur Caliskan: fatmanur.caliskan@stu.fsm.edu.tr
Cihan Yilmaz: cihan.yilmaz@stu.fsm.edu.tr

Feel free to further customize the content as needed.

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

dataprecf-0.8.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

dataprecf-0.8.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file dataprecf-0.8.0.tar.gz.

File metadata

  • Download URL: dataprecf-0.8.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.6

File hashes

Hashes for dataprecf-0.8.0.tar.gz
Algorithm Hash digest
SHA256 76d0eb136031b1077c764bfb8a44b1c79e870ea97d2e29d97fac8855aac6df80
MD5 38159b17424ad0eca12a9b132b5e6ea1
BLAKE2b-256 a31bf5c33656afcf6a9f2995038ac449a3f4f71ce157ace6ab1f0d184121bcfe

See more details on using hashes here.

File details

Details for the file dataprecf-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: dataprecf-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.6

File hashes

Hashes for dataprecf-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd89b28a19f32436fa5e649fb438c595c6da30f71d360af63bf47519dd0e327f
MD5 ff48d1a13860a98b20ca5e9f3703c2f3
BLAKE2b-256 cd964a8ea3902d4d5f14b0bc6cba85f78fd63c203dcf4b1e7b249f4210be7e7e

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