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.11.0.tar.gz (4.4 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.11.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dataprecf-0.11.0.tar.gz
Algorithm Hash digest
SHA256 ebaf70caf74a19efd4e436b94f6224381880904fca22f751c1adad4b6ea98d34
MD5 a0d21b9b2b27fea2e67a9193067e038a
BLAKE2b-256 fea3d6d351f30934795ebc315043ac299b2ab89725db820f23218a31233ddf57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dataprecf-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0f88410efe08804fb84501be99f72a63648be6e769e9ad960a8aa61423828eb
MD5 176c171a8b8f39c7b812c899be269935
BLAKE2b-256 bb0a7fde5b14d372f06edd90bf91aae51c996ee392d14809ab94b3cf25434896

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