Skip to main content

A library to make data worse

Project description

Complexifier

Make your pandas even worse!

Problem

When teaching students to work with data, an important lesson is how to clean it.

The problem with this is that there are two types of datasets available on the internet:

  1. Data that is good, but already cleaned
  2. Data that is not cleaned, but is terrible and incomprehensible

Complexifier solves this problem by allowing you take the former and turn it into a better version of the latter!

Dependencies

  • pandas
  • typo
  • random

Installation

complexifier can be installed using pip

pip install complexifier

Usage

Go to the documentation

Once installed you can use complexifier to add mistakes and outliers to your data

This library has several methods available:

create_spag_error

create_spag_error(word: str) -> str

Introduces a 10% chance of a random spelling error in a given word. This function is useful for simulating typos and spelling mistakes in text data.

introduce_spag_error

introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame

Applies the create_spag_error function to each string entry in specified columns of a DataFrame, introducing random spelling errors with a 10% probability.

add_or_subtract_outliers

add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame

Randomly adds or subtracts values in specified numeric columns at random indices, simulating outliers between 1% and 10% of the rows.

add_standard_deviations

add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame

Adds between 1 to 5 standard deviations to random entries in specified numeric columns to simulate data anomalies.

duplicate_rows

duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame

Introduces duplicate rows into a DataFrame. This function is useful for testing deduplication processes.

add_nulls

add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame

Inserts null values into specified DataFrame columns. This simulates missing data conditions.

mess_it_up

mess_it_up(df: pd.DataFrame, columns=None, min_std=1, max_std=5, sample_size=None,min_percent=1, max_percent=10, introduce_spag=True, add_outliers=True, add_std=True, duplicate=True, add_null=True) -> pd.DataFrame

Adds all (or some) of the above methods. Really messes it up.

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

complexifier-0.3.2.tar.gz (444.1 kB view details)

Uploaded Source

Built Distribution

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

complexifier-0.3.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file complexifier-0.3.2.tar.gz.

File metadata

  • Download URL: complexifier-0.3.2.tar.gz
  • Upload date:
  • Size: 444.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for complexifier-0.3.2.tar.gz
Algorithm Hash digest
SHA256 71636993e0e13510053a82f94f678aec08a97d4d9e4c8e32b5bec40a27745772
MD5 5dcaa42ceeb27c9bdcaf2de7850eec5e
BLAKE2b-256 13b427011860d47ffc3aabd77024c2157da92a2bdd8b93be4e0f823e0aedfc4c

See more details on using hashes here.

File details

Details for the file complexifier-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: complexifier-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for complexifier-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 236535d571b069b19f92132a1d3585f22998175e2e5de15aba2ee9f06827e20e
MD5 37484d453500d5b48b4809b308795b2a
BLAKE2b-256 5204cf62f1f16974c23dc42acefd7c3cfe50810b5934fc048fe882590fe3ee44

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