Skip to main content

A package containing tools for robust data cleaning.

Project description

datamop

Documentation StatusPython 3.11codecov

datamop is a data cleaning and wrangling package designed to streamline the preprocessing of datasets. Whether you meet missing values, inconsistent categorical columns or need scaling for numeric columns when dealing with data. datamop provides a simple and consistent solution to automate and simplify these repetitive tasks. The following are core functions of this package:

  • sweep_nulls(): Handle missing values such as imputation or removal, based on user preference.

  • column_encoder(): Encodes categorical columns using either one-hot encoding or ordinal encoding, based on user preference.

  • column_scaler(): Scales numerical columns, including Min-Max scaling and Z-score standardization, based on user preference.

datamop fits into Python data preprocessing ecosystem by offering a more lightweight and user-friendly alternative to complex libraries like pandas, scikit-learn. datamop focuses specifically on handling missing values, encoding categorical columns and normalizing numerical columns. datamop changes scikit-learn tasks performed by modules like SimpleImputer, OneHotEncoder, OrdinalEncoder and StandardScaler with fewer steps and easier customization. Similar functionality can be found in:

Contributors

The authors of this project are Sepehr Heydarian, Ximin Xu, and Essie Zhang.

Installation

$ pip install datamop

Usage

datamop can be used to encode columns in a DataFrame using one-hot or ordinal encoding as follows:

import pandas as pd
import datamop

df = pd.DataFrame({
    'Sport': ['Tennis', 'Basketball', 'Football', 'Badminton'],
    'Level': ['A', 'B', 'C', 'D']
})

encoded_df_onehot = datamop.column_encoder(df, columns=['Sport'], method='one-hot')
encoded_df_ordinal = datamop.column_encoder(df, columns=['Level'], method='ordinal', order={'Level': ['A', 'B', 'C', 'D']})

This package can also be used to handle missing values such as imputation or removal, based on user preference as following:

import numpy as np
df = pd.DataFrame({
    'a': [10, np.nan, 30],
    'b': [1.5, 2.5, np.nan],
    'c': ['x', np.nan, 'z']
    })
cleaned = datamop.sweep_nulls(df, strategy='mean')

Additionally, this package can be used to scale numerical columns as following:

df = pd.DataFrame({"price": [25, 50, 75]})
df_scaled = datamop.column_scaler(df, column = 'price', method='minmax', new_min=0, new_max=1)

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms. See CONTRIBUTING file here.

License

datamop was created by Sepehr Heydarian, Ximin Xu, Essie Zhang. It is licensed under the terms of the MIT license. See LICENSE file here.

Credits

datamop was created with cookiecutter and the py-pkgs-cookiecutter template.

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

datamop-1.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

datamop-1.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file datamop-1.1.1.tar.gz.

File metadata

  • Download URL: datamop-1.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for datamop-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b41c329351b21800acedd2e6181cb8bfb38f991991495fea196d8982271d29cb
MD5 6b49413d057ec622baf0252a2163ebd4
BLAKE2b-256 7745fb12eed2fa0c8eec9368bd61cf2a345ad81dca1737d240174388b9748687

See more details on using hashes here.

File details

Details for the file datamop-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: datamop-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for datamop-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6f81aa582b3e0558584a6ea551b8b08983e7e8c39eac9a73a37f7ba470a2ade
MD5 b56ae6aa846a97152d0c84bce244fea8
BLAKE2b-256 85bbe1079799e4aee9c36c1e926543a65ccae54b89c36e708630e3ff12889908

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