A package containing tools for robust data cleaning.
Project description
datamop
datamop is a data cleaning and wrangling python 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.
Documentation
The full documentation including package tutorial and API reference can be found on the ReadTheDocs here
Functions
The following are core functions of this package:
-
sweep_nulls(): Handles 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.
Installation
$ pip install datamop
Usage
All functions in datamop take a pandas DataFrame as input. Each function returns a modified pandas DataFrame as output, with the specified transformations applied.
For a quick glimpse into what datamop can do, here are a few simple examples:
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)
Python Ecosystem
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:
-
pandas (Functions like
fillna()for handling missing values,get_dummies()for one-hot encoding, andreplace()for categorical encoding): pandas documentation -
scikit-learn (Modules like
SimpleImputerfor missing value imputation,OneHotEncoderfor one-hot encoding,OrdinalEncoderfor ordinal encoding, andMinMaxScalerorStandardScalerfor scaling numerical data.): scikit-learn preprocessing
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.
Contributors
The authors of this project are Sepehr Heydarian, Ximin Xu, and Essie Zhang.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datamop-1.1.2.tar.gz.
File metadata
- Download URL: datamop-1.1.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c88f3d70fef88f36e5f9d022b0934b0734187c333cfcd26c28671621d643b49
|
|
| MD5 |
f48684ba2d55500283706532e89fb9b2
|
|
| BLAKE2b-256 |
8fa8138cae76345bac7ce92bb576809b66c1dda8081458bdf9fc11753598fe9e
|
File details
Details for the file datamop-1.1.2-py3-none-any.whl.
File metadata
- Download URL: datamop-1.1.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cd44915b1bc9180e5e3dec1fbbe36a162b9123689078b6d744ca763e08a8474
|
|
| MD5 |
c4a4ec09b81ced446a492e6fdc1f0cc9
|
|
| BLAKE2b-256 |
fb6cd59ee6ee5be4cfb3b3b642f1fc189d0555a1ddc1a4d69ce8241055ed22f1
|