A library to make data worse
Project description
Complexifier
This makes your pandas dataframe even worse
Dependencies
pandastyporandom
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
Parameters:
word(str): The original word to potentially alter.
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(pd.DataFrame): The DataFrame to alter.columns(list or str): Column names to apply errors to. 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(pd.DataFrame): The DataFrame to modify.columns(list or str): Column names to adjust. Defaults to all numeric columns if not specified.
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(pd.DataFrame): The DataFrame to manipulate.columns(list or str): Column names to modify. Defaults to numeric columns if not specified.min_std(int): Minimum number of standard deviations to add. Defaults to 1max_std(int): Maximum number of standard deviations to add. Defaults to 5
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(pd.DataFrame): DataFrame to which duplicates will be added.sample_size(int): 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(pd.DataFrame): The DataFrame to modify.columns(list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.min_percent(int): Minimum percentage of null values to insert. Defaults to 1%max_percent(int): Maximum percentage of null values to insert. Defaults to 10%
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.
Parameters:
df(pd.DataFrame): The DataFrame to modify.columns(list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.min_std(int): Minimum number of standard deviations to add. Defaults to 1max_std(int): Maximum number of standard deviations to add. Defaults to 5sample_size(int, optional): Number of rows to duplicate. Randomly selected if not specified.min_percent(int): Minimum percentage of null values to insert. Defaults to 1%max_percent(int): Maximum percentage of null values to insert. Defaults to 10%introduce_spag(bool): Adds spelling and grammar errors into string data. Defaults to Trueadd_outliers(bool): Adds outliers to numerical data. Defaults to Trueadd_std(bool): Adds standard deviations to the data. Defaults to Trueduplicate(bool): Adds duplicate rows to the data. Defaults to Trueadd_null(bool): Adds null values to the dataset. Defaults to True
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 complexifier-0.3.1.tar.gz.
File metadata
- Download URL: complexifier-0.3.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d11a40b35d89e336fce217a613e8da892da7886da2d421305644a052c9d3a697
|
|
| MD5 |
38d139859a7c5b8b697619be73d1ed06
|
|
| BLAKE2b-256 |
a1658071e2d1488cb960efae9adc6907caf6a30967913de71055616841686776
|
File details
Details for the file complexifier-0.3.1-py3-none-any.whl.
File metadata
- Download URL: complexifier-0.3.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d77b1821cf8ed8105d44545f14dacb71451b11f081201b5bf785344699edcd
|
|
| MD5 |
843c676e0d76ffb0dc58a2fe2cfc0ffe
|
|
| BLAKE2b-256 |
45459be3f224c9cf6c8735631e8c68bc017da6d17a0e95dfdf76d5832b7ea09d
|