Skip to main content

A library to make data worse

Project description

Complexifier

This makes your pandas dataframe even worse

Dependencies

  • pandas
  • typo
  • random

Installation

complexifier can be installed using pip

pip install complexifier

Usage

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

This library has several methods available:

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(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.

Parameters:

  • df: The DataFrame to be altered.
  • columns: Optional; specify column names to apply errors to. If not provided, it defaults to all string columns.

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.

Parameters:

  • df: DataFrame to be modified.
  • columns: Optional; specify columns to adjust.

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.

Parameters:

  • df: The DataFrame to manipulate.
  • columns: Optional; specify columns to modify.
  • min_std: Minimum number of standard deviations to add.
  • max_std: Maximum number of standard deviations to add.

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

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

Parameters:

  • df: DataFrame where duplicates will be introduced.
  • sample_size: Optional; number of rows to duplicate. A random percentage between 1% and 10% if not specified.

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.

Parameters:

  • df: The DataFrame to modify.
  • columns: Optional; specific columns to add nulls to.
  • min_percent: Minimum percentage of null values to insert.
  • max_percent: Maximum percentage of null values to insert.

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.2.0.tar.gz (3.2 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.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for complexifier-0.2.0.tar.gz
Algorithm Hash digest
SHA256 70722adb3fa7b14ea6c9c7535de8773cba89422e2da516b9006afe5adf6f1aa9
MD5 7f8dab3434fc04a82ba7cad34ac5259c
BLAKE2b-256 b8378d52da51635c6a809a7beba63d454e0c2000a9342b51df2884b5bb42d405

See more details on using hashes here.

File details

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

File metadata

  • Download URL: complexifier-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf3c1f557f5d08cf1158466cd148e8a46c05944e6f8561064e1e36adce22d6db
MD5 058874d3e38de63e01078851205a4410
BLAKE2b-256 e95d8929fc3652a7d22f958d631978f02fd58ccb2621a2b7320044d733fc2193

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