complexifier 0.3.1__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- complexifier-0.3.3/.github/workflows/main.yml +32 -0
- complexifier-0.3.3/.github/workflows/sphinx.yml +26 -0
- {complexifier-0.3.1 → complexifier-0.3.3}/.gitignore +3 -1
- complexifier-0.3.3/PKG-INFO +94 -0
- complexifier-0.3.3/README.md +81 -0
- complexifier-0.3.3/README.rst +182 -0
- complexifier-0.3.3/assets/complexifier.jpeg +0 -0
- complexifier-0.3.3/docs/Makefile +20 -0
- complexifier-0.3.3/docs/make.bat +35 -0
- complexifier-0.3.3/docs/source/conf.py +28 -0
- complexifier-0.3.3/docs/source/index.rst +207 -0
- {complexifier-0.3.1 → complexifier-0.3.3}/pyproject.toml +1 -1
- complexifier-0.3.1/PKG-INFO +0 -105
- complexifier-0.3.1/README.md +0 -92
- {complexifier-0.3.1 → complexifier-0.3.3}/LICENSE +0 -0
- {complexifier-0.3.1 → complexifier-0.3.3}/src/complexifier/__init__.py +0 -0
- {complexifier-0.3.1 → complexifier-0.3.3}/src/complexifier/main.py +0 -0
- {complexifier-0.3.1 → complexifier-0.3.3}/src/complexifier/test_main.py +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Test Library
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- '**'
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v4
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.x'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -r requirements.txt
|
|
28
|
+
|
|
29
|
+
- name: Run tests with coverage
|
|
30
|
+
run: |
|
|
31
|
+
pytest --cov=complexifier
|
|
32
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: "Sphinx: Render docs"
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
persist-credentials: false
|
|
14
|
+
- name: Build HTML
|
|
15
|
+
uses: ammaraskar/sphinx-action@master
|
|
16
|
+
- name: Upload artifacts
|
|
17
|
+
uses: actions/upload-artifact@v4
|
|
18
|
+
with:
|
|
19
|
+
name: html-docs
|
|
20
|
+
path: docs/build/html/
|
|
21
|
+
- name: Deploy
|
|
22
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
23
|
+
if: github.ref == 'refs/heads/main'
|
|
24
|
+
with:
|
|
25
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
26
|
+
publish_dir: docs/build/html
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: complexifier
|
|
3
|
+
Version: 0.3.3
|
|
4
|
+
Summary: A library to make data worse
|
|
5
|
+
Project-URL: Homepage, https://github.com/ruyzambrano/complexifier
|
|
6
|
+
Project-URL: Issues, https://github.com/ruyzambrano/complexifier/issues
|
|
7
|
+
Author-email: Ruy Zambrano <ruyzambrano@gmail.com>
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Complexifier
|
|
15
|
+
|
|
16
|
+
Make your pandas even worse!
|
|
17
|
+
|
|
18
|
+
## Problem
|
|
19
|
+
|
|
20
|
+
When teaching students to work with data, an important lesson is how to clean it.
|
|
21
|
+
|
|
22
|
+
The problem with this is that there are two types of datasets available on the internet:
|
|
23
|
+
|
|
24
|
+
1. Data that is good, but already cleaned
|
|
25
|
+
2. Data that is not cleaned, but is terrible and incomprehensible
|
|
26
|
+
|
|
27
|
+
Complexifier solves this problem by allowing you take the former and turn it into a better version of the latter!
|
|
28
|
+
|
|
29
|
+
## Dependencies
|
|
30
|
+
|
|
31
|
+
- `pandas`
|
|
32
|
+
- `typo`
|
|
33
|
+
- `random`
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
`complexifier` can be installed using `pip`
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
pip install complexifier
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
[Go to the documentation](https://ruyzambrano.github.io/complexifier/)
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Once installed you can use `complexifier` to add mistakes and outliers to your data
|
|
51
|
+
|
|
52
|
+
This library has several methods available:
|
|
53
|
+
|
|
54
|
+
### create_spag_error
|
|
55
|
+
|
|
56
|
+
`create_spag_error(word: str) -> str`
|
|
57
|
+
|
|
58
|
+
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.
|
|
59
|
+
|
|
60
|
+
### introduce_spag_error
|
|
61
|
+
|
|
62
|
+
`introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
63
|
+
|
|
64
|
+
Applies the create_spag_error function to each string entry in specified columns of a DataFrame, introducing random spelling errors with a 10% probability.
|
|
65
|
+
|
|
66
|
+
### add_or_subtract_outliers
|
|
67
|
+
|
|
68
|
+
`add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
69
|
+
|
|
70
|
+
Randomly adds or subtracts values in specified numeric columns at random indices, simulating outliers between 1% and 10% of the rows.
|
|
71
|
+
|
|
72
|
+
### add_standard_deviations
|
|
73
|
+
|
|
74
|
+
`add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame`
|
|
75
|
+
|
|
76
|
+
Adds between 1 to 5 standard deviations to random entries in specified numeric columns to simulate data anomalies.
|
|
77
|
+
|
|
78
|
+
### duplicate_rows
|
|
79
|
+
|
|
80
|
+
`duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame`
|
|
81
|
+
|
|
82
|
+
Introduces duplicate rows into a DataFrame. This function is useful for testing deduplication processes.
|
|
83
|
+
|
|
84
|
+
### add_nulls
|
|
85
|
+
|
|
86
|
+
`add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame`
|
|
87
|
+
|
|
88
|
+
Inserts null values into specified DataFrame columns. This simulates missing data conditions.
|
|
89
|
+
|
|
90
|
+
### mess_it_up
|
|
91
|
+
|
|
92
|
+
`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`
|
|
93
|
+
|
|
94
|
+
Adds all (or some) of the above methods. Really messes it up.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Complexifier
|
|
2
|
+
|
|
3
|
+
Make your pandas even worse!
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
When teaching students to work with data, an important lesson is how to clean it.
|
|
8
|
+
|
|
9
|
+
The problem with this is that there are two types of datasets available on the internet:
|
|
10
|
+
|
|
11
|
+
1. Data that is good, but already cleaned
|
|
12
|
+
2. Data that is not cleaned, but is terrible and incomprehensible
|
|
13
|
+
|
|
14
|
+
Complexifier solves this problem by allowing you take the former and turn it into a better version of the latter!
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
- `pandas`
|
|
19
|
+
- `typo`
|
|
20
|
+
- `random`
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
`complexifier` can be installed using `pip`
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pip install complexifier
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
[Go to the documentation](https://ruyzambrano.github.io/complexifier/)
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Once installed you can use `complexifier` to add mistakes and outliers to your data
|
|
38
|
+
|
|
39
|
+
This library has several methods available:
|
|
40
|
+
|
|
41
|
+
### create_spag_error
|
|
42
|
+
|
|
43
|
+
`create_spag_error(word: str) -> str`
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
### introduce_spag_error
|
|
48
|
+
|
|
49
|
+
`introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
50
|
+
|
|
51
|
+
Applies the create_spag_error function to each string entry in specified columns of a DataFrame, introducing random spelling errors with a 10% probability.
|
|
52
|
+
|
|
53
|
+
### add_or_subtract_outliers
|
|
54
|
+
|
|
55
|
+
`add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
56
|
+
|
|
57
|
+
Randomly adds or subtracts values in specified numeric columns at random indices, simulating outliers between 1% and 10% of the rows.
|
|
58
|
+
|
|
59
|
+
### add_standard_deviations
|
|
60
|
+
|
|
61
|
+
`add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame`
|
|
62
|
+
|
|
63
|
+
Adds between 1 to 5 standard deviations to random entries in specified numeric columns to simulate data anomalies.
|
|
64
|
+
|
|
65
|
+
### duplicate_rows
|
|
66
|
+
|
|
67
|
+
`duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame`
|
|
68
|
+
|
|
69
|
+
Introduces duplicate rows into a DataFrame. This function is useful for testing deduplication processes.
|
|
70
|
+
|
|
71
|
+
### add_nulls
|
|
72
|
+
|
|
73
|
+
`add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame`
|
|
74
|
+
|
|
75
|
+
Inserts null values into specified DataFrame columns. This simulates missing data conditions.
|
|
76
|
+
|
|
77
|
+
### mess_it_up
|
|
78
|
+
|
|
79
|
+
`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`
|
|
80
|
+
|
|
81
|
+
Adds all (or some) of the above methods. Really messes it up.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Complexifier
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Make your pandas even worse!
|
|
5
|
+
|
|
6
|
+
Complexifier is a Python library crafted to transform clean datasets into messy versions by introducing random errors and anomalies. This is particularly useful for educational purposes, where students learn to clean data through practical experience.
|
|
7
|
+
|
|
8
|
+
Problem
|
|
9
|
+
-------
|
|
10
|
+
|
|
11
|
+
When teaching students to work with data, an important lesson is how to clean it.
|
|
12
|
+
|
|
13
|
+
The problem with this is that there are two types of datasets available on the internet:
|
|
14
|
+
|
|
15
|
+
1. Data that is good, but already cleaned
|
|
16
|
+
2. Data that is not cleaned, but is terrible and incomprehensible
|
|
17
|
+
|
|
18
|
+
Complexifier solves this problem by allowing you to take the former and turn it into a better version of the latter!
|
|
19
|
+
|
|
20
|
+
Dependencies
|
|
21
|
+
------------
|
|
22
|
+
|
|
23
|
+
Complexifier relies on the following packages:
|
|
24
|
+
|
|
25
|
+
- `pandas`
|
|
26
|
+
- `typo`
|
|
27
|
+
- `random`
|
|
28
|
+
|
|
29
|
+
Ensure these dependencies are installed in your environment.
|
|
30
|
+
|
|
31
|
+
Installation
|
|
32
|
+
------------
|
|
33
|
+
|
|
34
|
+
You can install `complexifier` via `pip`:
|
|
35
|
+
|
|
36
|
+
.. code-block:: sh
|
|
37
|
+
|
|
38
|
+
pip install complexifier
|
|
39
|
+
|
|
40
|
+
Usage
|
|
41
|
+
-----
|
|
42
|
+
|
|
43
|
+
Once installed, use `complexifier` to add mistakes and simulate anomalies in your data. This library provides several methods:
|
|
44
|
+
|
|
45
|
+
Methods
|
|
46
|
+
-------
|
|
47
|
+
|
|
48
|
+
create_spag_error
|
|
49
|
+
~~~~~~~~~~~~~~~~~
|
|
50
|
+
|
|
51
|
+
.. code-block:: python
|
|
52
|
+
|
|
53
|
+
create_spag_error(word: str) -> str
|
|
54
|
+
|
|
55
|
+
Introduces a 10% chance of a random spelling error in a given word, helpful for simulating typos.
|
|
56
|
+
|
|
57
|
+
**Parameters**:
|
|
58
|
+
- `word` (str): The original word to potentially alter.
|
|
59
|
+
|
|
60
|
+
introduce_spag_error
|
|
61
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
62
|
+
|
|
63
|
+
.. code-block:: python
|
|
64
|
+
|
|
65
|
+
introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame
|
|
66
|
+
|
|
67
|
+
Applies `create_spag_error` to each string entry in specified DataFrame columns, introducing random spelling errors with a 10% probability.
|
|
68
|
+
|
|
69
|
+
**Parameters**:
|
|
70
|
+
- `df` (pd.DataFrame): The DataFrame to alter.
|
|
71
|
+
- `columns` (list or str): Column names to apply errors to. Defaults to all string columns.
|
|
72
|
+
|
|
73
|
+
add_or_subtract_outliers
|
|
74
|
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
75
|
+
|
|
76
|
+
.. code-block:: python
|
|
77
|
+
|
|
78
|
+
add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame
|
|
79
|
+
|
|
80
|
+
Randomly adds or subtracts values in specified numeric columns, simulating outliers in 1% to 10% of rows.
|
|
81
|
+
|
|
82
|
+
**Parameters**:
|
|
83
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
84
|
+
- `columns` (list or str): Column names to adjust. Defaults to all numeric columns if not specified.
|
|
85
|
+
|
|
86
|
+
add_standard_deviations
|
|
87
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
88
|
+
|
|
89
|
+
.. code-block:: python
|
|
90
|
+
|
|
91
|
+
add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame
|
|
92
|
+
|
|
93
|
+
Adds between 1 to 5 standard deviations to random entries in numeric columns to simulate data anomalies.
|
|
94
|
+
|
|
95
|
+
**Parameters**:
|
|
96
|
+
- `df` (pd.DataFrame): The DataFrame to manipulate.
|
|
97
|
+
- `columns` (list or str): Column names to modify. Defaults to numeric columns if not specified.
|
|
98
|
+
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1.
|
|
99
|
+
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5.
|
|
100
|
+
|
|
101
|
+
duplicate_rows
|
|
102
|
+
~~~~~~~~~~~~~~
|
|
103
|
+
|
|
104
|
+
.. code-block:: python
|
|
105
|
+
|
|
106
|
+
duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame
|
|
107
|
+
|
|
108
|
+
Introduces duplicate rows into a DataFrame, useful for testing deduplication processes.
|
|
109
|
+
|
|
110
|
+
**Parameters**:
|
|
111
|
+
- `df` (pd.DataFrame): DataFrame to which duplicates will be added.
|
|
112
|
+
- `sample_size` (int): Number of rows to duplicate. A random percentage between 1% and 10% if not specified.
|
|
113
|
+
|
|
114
|
+
add_nulls
|
|
115
|
+
~~~~~~~~~
|
|
116
|
+
|
|
117
|
+
.. code-block:: python
|
|
118
|
+
|
|
119
|
+
add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame
|
|
120
|
+
|
|
121
|
+
Inserts null values into specified DataFrame columns, simulating missing data conditions.
|
|
122
|
+
|
|
123
|
+
**Parameters**:
|
|
124
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
125
|
+
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
126
|
+
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%.
|
|
127
|
+
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%.
|
|
128
|
+
|
|
129
|
+
mess_it_up
|
|
130
|
+
~~~~~~~~~~
|
|
131
|
+
|
|
132
|
+
.. code-block:: python
|
|
133
|
+
|
|
134
|
+
mess_it_up(df: pd.DataFrame, columns=None, min_std=1, max_std=5, sample_size=None, min_percent=1, max_percent=10,
|
|
135
|
+
introduce_spag=True, add_outliers=True, add_std=True, duplicate=True, add_null=True) -> pd.DataFrame
|
|
136
|
+
|
|
137
|
+
Integrates all methods to add errors comprehensively to the DataFrame.
|
|
138
|
+
|
|
139
|
+
**Parameters**:
|
|
140
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
141
|
+
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
142
|
+
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1.
|
|
143
|
+
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5.
|
|
144
|
+
- `sample_size` (int, optional): Number of rows to duplicate. Randomly selected if not specified.
|
|
145
|
+
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%.
|
|
146
|
+
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%.
|
|
147
|
+
- `introduce_spag` (bool): Adds spelling and grammar errors into string data. Defaults to True.
|
|
148
|
+
- `add_outliers` (bool): Adds outliers to numerical data. Defaults to True.
|
|
149
|
+
- `add_std` (bool): Adds standard deviations to the data. Defaults to True.
|
|
150
|
+
- `duplicate` (bool): Adds duplicate rows to the data. Defaults to True.
|
|
151
|
+
- `add_null` (bool): Adds null values to the dataset. Defaults to True.
|
|
152
|
+
|
|
153
|
+
Contributing
|
|
154
|
+
------------
|
|
155
|
+
|
|
156
|
+
Feel free to contribute by submitting a pull request on GitHub. For large changes, please open an issue to discuss before implementing changes.
|
|
157
|
+
|
|
158
|
+
License
|
|
159
|
+
-------
|
|
160
|
+
|
|
161
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
162
|
+
|
|
163
|
+
Contact Information
|
|
164
|
+
-------------------
|
|
165
|
+
|
|
166
|
+
For support or inquiries, please contact the maintainer at maintainer@example.com.
|
|
167
|
+
|
|
168
|
+
Changelog
|
|
169
|
+
---------
|
|
170
|
+
|
|
171
|
+
### Version 1.0
|
|
172
|
+
|
|
173
|
+
- Initial release with functionality covering typos, outliers, duplicate rows, and null values.
|
|
174
|
+
|
|
175
|
+
Badges
|
|
176
|
+
------
|
|
177
|
+
|
|
178
|
+
.. image:: https://img.shields.io/badge/build-passing-brightgreen
|
|
179
|
+
:target: https://github.com/yourusername/complexifier
|
|
180
|
+
|
|
181
|
+
.. image:: https://img.shields.io/badge/coverage-95%25-green
|
|
182
|
+
:target: https://codecov.io/gh/yourusername/complexifier
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
|
|
9
|
+
project = 'Complexifier'
|
|
10
|
+
copyright = '2024, Ruy Zambrano'
|
|
11
|
+
author = 'Ruy Zambrano'
|
|
12
|
+
release = '0.3.1'
|
|
13
|
+
|
|
14
|
+
# -- General configuration ---------------------------------------------------
|
|
15
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
16
|
+
|
|
17
|
+
extensions = []
|
|
18
|
+
|
|
19
|
+
templates_path = ['_templates']
|
|
20
|
+
exclude_patterns = []
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# -- Options for HTML output -------------------------------------------------
|
|
25
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
26
|
+
|
|
27
|
+
html_theme = 'groundwork'
|
|
28
|
+
html_static_path = ['_static']
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Complexifier
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Make your pandas even worse!
|
|
5
|
+
|
|
6
|
+
Complexifier is a Python library crafted to transform clean datasets into messy versions by introducing random errors and anomalies. This is particularly useful for educational purposes, where students learn to clean data through practical experience.
|
|
7
|
+
|
|
8
|
+
Problem
|
|
9
|
+
-------
|
|
10
|
+
|
|
11
|
+
When teaching students to work with data, an important lesson is how to clean it.
|
|
12
|
+
|
|
13
|
+
The problem with this is that there are two types of datasets available on the internet:
|
|
14
|
+
|
|
15
|
+
1. Data that is good, but already cleaned
|
|
16
|
+
2. Data that is not cleaned, but is terrible and incomprehensible
|
|
17
|
+
|
|
18
|
+
Complexifier solves this problem by allowing you to take the former and turn it into a better version of the latter!
|
|
19
|
+
|
|
20
|
+
Dependencies
|
|
21
|
+
------------
|
|
22
|
+
|
|
23
|
+
Complexifier relies on the following packages:
|
|
24
|
+
|
|
25
|
+
- `pandas`
|
|
26
|
+
- `typo`
|
|
27
|
+
- `random`
|
|
28
|
+
|
|
29
|
+
Ensure these dependencies are installed in your environment.
|
|
30
|
+
|
|
31
|
+
Installation
|
|
32
|
+
------------
|
|
33
|
+
|
|
34
|
+
You can install `complexifier` via `pip`:
|
|
35
|
+
|
|
36
|
+
.. code-block:: sh
|
|
37
|
+
|
|
38
|
+
pip install complexifier
|
|
39
|
+
|
|
40
|
+
Usage
|
|
41
|
+
-----
|
|
42
|
+
|
|
43
|
+
Once installed, use `complexifier` to add mistakes and simulate anomalies in your data. This library provides several methods:
|
|
44
|
+
|
|
45
|
+
Methods
|
|
46
|
+
-------
|
|
47
|
+
|
|
48
|
+
create_spag_error
|
|
49
|
+
~~~~~~~~~~~~~~~~~
|
|
50
|
+
|
|
51
|
+
.. code-block:: python
|
|
52
|
+
|
|
53
|
+
create_spag_error(word: str) -> str
|
|
54
|
+
|
|
55
|
+
Introduces a 10% chance of a random spelling error in a given word, helpful for simulating typos.
|
|
56
|
+
|
|
57
|
+
**Parameters**:
|
|
58
|
+
|
|
59
|
+
- `word` (str): The original word to potentially alter.
|
|
60
|
+
|
|
61
|
+
introduce_spag_error
|
|
62
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
63
|
+
|
|
64
|
+
.. code-block:: python
|
|
65
|
+
|
|
66
|
+
introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame
|
|
67
|
+
|
|
68
|
+
Applies `create_spag_error` to each string entry in specified DataFrame columns, introducing random spelling errors with a 10% probability.
|
|
69
|
+
|
|
70
|
+
**Parameters**:
|
|
71
|
+
|
|
72
|
+
- `df` (pd.DataFrame): The DataFrame to alter.
|
|
73
|
+
|
|
74
|
+
- `columns` (list or str): Column names to apply errors to. Defaults to all string columns.
|
|
75
|
+
|
|
76
|
+
add_or_subtract_outliers
|
|
77
|
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
78
|
+
|
|
79
|
+
.. code-block:: python
|
|
80
|
+
|
|
81
|
+
add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame
|
|
82
|
+
|
|
83
|
+
Randomly adds or subtracts values in specified numeric columns, simulating outliers in 1% to 10% of rows.
|
|
84
|
+
|
|
85
|
+
**Parameters**:
|
|
86
|
+
|
|
87
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
88
|
+
|
|
89
|
+
- `columns` (list or str): Column names to adjust. Defaults to all numeric columns if not specified.
|
|
90
|
+
|
|
91
|
+
add_standard_deviations
|
|
92
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
93
|
+
|
|
94
|
+
.. code-block:: python
|
|
95
|
+
|
|
96
|
+
add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame
|
|
97
|
+
|
|
98
|
+
Adds between 1 to 5 standard deviations to random entries in numeric columns to simulate data anomalies.
|
|
99
|
+
|
|
100
|
+
**Parameters**:
|
|
101
|
+
|
|
102
|
+
- `df` (pd.DataFrame): The DataFrame to manipulate.
|
|
103
|
+
|
|
104
|
+
- `columns` (list or str): Column names to modify. Defaults to numeric columns if not specified.
|
|
105
|
+
|
|
106
|
+
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1.
|
|
107
|
+
|
|
108
|
+
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5.
|
|
109
|
+
|
|
110
|
+
duplicate_rows
|
|
111
|
+
~~~~~~~~~~~~~~
|
|
112
|
+
|
|
113
|
+
.. code-block:: python
|
|
114
|
+
|
|
115
|
+
duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame
|
|
116
|
+
|
|
117
|
+
Introduces duplicate rows into a DataFrame, useful for testing deduplication processes.
|
|
118
|
+
|
|
119
|
+
**Parameters**:
|
|
120
|
+
|
|
121
|
+
- `df` (pd.DataFrame): DataFrame to which duplicates will be added.
|
|
122
|
+
|
|
123
|
+
- `sample_size` (int): Number of rows to duplicate. A random percentage between 1% and 10% if not specified.
|
|
124
|
+
|
|
125
|
+
add_nulls
|
|
126
|
+
~~~~~~~~~
|
|
127
|
+
|
|
128
|
+
.. code-block:: python
|
|
129
|
+
|
|
130
|
+
add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame
|
|
131
|
+
|
|
132
|
+
Inserts null values into specified DataFrame columns, simulating missing data conditions.
|
|
133
|
+
|
|
134
|
+
**Parameters**:
|
|
135
|
+
|
|
136
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
137
|
+
|
|
138
|
+
- `columns` (list or str): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
139
|
+
|
|
140
|
+
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%.
|
|
141
|
+
|
|
142
|
+
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%.
|
|
143
|
+
|
|
144
|
+
mess_it_up
|
|
145
|
+
~~~~~~~~~~
|
|
146
|
+
|
|
147
|
+
.. code-block:: python
|
|
148
|
+
|
|
149
|
+
mess_it_up(df: pd.DataFrame, columns=None, min_std=1, max_std=5, sample_size=None, min_percent=1, max_percent=10,
|
|
150
|
+
introduce_spag=True, add_outliers=True, add_std=True, duplicate=True, add_null=True) -> pd.DataFrame
|
|
151
|
+
|
|
152
|
+
Integrates all methods to add errors comprehensively to the DataFrame.
|
|
153
|
+
|
|
154
|
+
**Parameters**:
|
|
155
|
+
|
|
156
|
+
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
157
|
+
|
|
158
|
+
- `columns` (list or str): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
159
|
+
|
|
160
|
+
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1.
|
|
161
|
+
|
|
162
|
+
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5.
|
|
163
|
+
|
|
164
|
+
- `sample_size` (int): Number of rows to duplicate. Randomly selected if not specified.
|
|
165
|
+
|
|
166
|
+
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%.
|
|
167
|
+
|
|
168
|
+
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%.
|
|
169
|
+
|
|
170
|
+
- `introduce_spag` (bool): Adds spelling and grammar errors into string data. Defaults to True.
|
|
171
|
+
|
|
172
|
+
- `add_outliers` (bool): Adds outliers to numerical data. Defaults to True.
|
|
173
|
+
|
|
174
|
+
- `add_std` (bool): Adds standard deviations to the data. Defaults to True.
|
|
175
|
+
|
|
176
|
+
- `duplicate` (bool): Adds duplicate rows to the data. Defaults to True.
|
|
177
|
+
|
|
178
|
+
- `add_null` (bool): Adds null values to the dataset. Defaults to True.
|
|
179
|
+
|
|
180
|
+
Contributing
|
|
181
|
+
------------
|
|
182
|
+
|
|
183
|
+
Feel free to contribute by submitting a pull request on GitHub. For large changes, please open an issue to discuss before implementing changes.
|
|
184
|
+
|
|
185
|
+
License
|
|
186
|
+
-------
|
|
187
|
+
|
|
188
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|
|
189
|
+
|
|
190
|
+
Contact Information
|
|
191
|
+
-------------------
|
|
192
|
+
|
|
193
|
+
For support or inquiries, please contact Ruy at ruyzambrano@gmail.com
|
|
194
|
+
|
|
195
|
+
Changelog
|
|
196
|
+
---------
|
|
197
|
+
|
|
198
|
+
Version 0.3.3
|
|
199
|
+
|
|
200
|
+
Badges
|
|
201
|
+
------
|
|
202
|
+
|
|
203
|
+
.. image:: https://img.shields.io/badge/build-passing-brightgreen
|
|
204
|
+
:target: https://github.com/yourusername/complexifier
|
|
205
|
+
|
|
206
|
+
.. image:: https://img.shields.io/badge/coverage-95%25-green
|
|
207
|
+
:target: https://codecov.io/gh/yourusername/complexifier
|
complexifier-0.3.1/PKG-INFO
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: complexifier
|
|
3
|
-
Version: 0.3.1
|
|
4
|
-
Summary: A library to make data worse
|
|
5
|
-
Project-URL: Homepage, https://github.com/ruyzambrano/complexifier
|
|
6
|
-
Project-URL: Issues, https://github.com/ruyzambrano/complexifier/issues
|
|
7
|
-
Author-email: Ruy Zambrano <ruyzambrano@gmail.com>
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Requires-Python: >=3.8
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
|
|
14
|
-
# Complexifier
|
|
15
|
-
|
|
16
|
-
This makes your pandas dataframe even worse
|
|
17
|
-
|
|
18
|
-
## Dependencies
|
|
19
|
-
|
|
20
|
-
- `pandas`
|
|
21
|
-
- `typo`
|
|
22
|
-
- `random`
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
`complexifier` can be installed using `pip`
|
|
27
|
-
|
|
28
|
-
```sh
|
|
29
|
-
pip install complexifier
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
Once installed you can use `complexifier` to add mistakes and outliers to your data
|
|
35
|
-
|
|
36
|
-
This library has several methods available:
|
|
37
|
-
|
|
38
|
-
### `create_spag_error(word: str) -> str`
|
|
39
|
-
|
|
40
|
-
**Parameters**:
|
|
41
|
-
- `word` (str): The original word to potentially alter.
|
|
42
|
-
|
|
43
|
-
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.
|
|
44
|
-
|
|
45
|
-
### `introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
46
|
-
|
|
47
|
-
Applies the create_spag_error function to each string entry in specified columns of a DataFrame, introducing random spelling errors with a 10% probability.
|
|
48
|
-
|
|
49
|
-
**Parameters**:
|
|
50
|
-
- `df` (pd.DataFrame): The DataFrame to alter.
|
|
51
|
-
- `columns` (list or str): Column names to apply errors to. Defaults to all string columns.
|
|
52
|
-
|
|
53
|
-
### `add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
54
|
-
|
|
55
|
-
Randomly adds or subtracts values in specified numeric columns at random indices, simulating outliers between 1% and 10% of the rows.
|
|
56
|
-
|
|
57
|
-
**Parameters**:
|
|
58
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
59
|
-
- `columns` (list or str): Column names to adjust. Defaults to all numeric columns if not specified.
|
|
60
|
-
|
|
61
|
-
### `add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame`
|
|
62
|
-
|
|
63
|
-
Adds between 1 to 5 standard deviations to random entries in specified numeric columns to simulate data anomalies.
|
|
64
|
-
|
|
65
|
-
**Parameters**:
|
|
66
|
-
- `df` (pd.DataFrame): The DataFrame to manipulate.
|
|
67
|
-
- `columns` (list or str): Column names to modify. Defaults to numeric columns if not specified.
|
|
68
|
-
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1
|
|
69
|
-
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5
|
|
70
|
-
|
|
71
|
-
### `duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame`
|
|
72
|
-
|
|
73
|
-
Introduces duplicate rows into a DataFrame. This function is useful for testing deduplication processes.
|
|
74
|
-
|
|
75
|
-
**Parameters**:
|
|
76
|
-
- `df` (pd.DataFrame): DataFrame to which duplicates will be added.
|
|
77
|
-
- `sample_size` (int): number of rows to duplicate. A random percentage between 1% and 10% if not specified.
|
|
78
|
-
|
|
79
|
-
### `add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame`
|
|
80
|
-
|
|
81
|
-
Inserts null values into specified DataFrame columns. This simulates missing data conditions.
|
|
82
|
-
|
|
83
|
-
**Parameters**:
|
|
84
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
85
|
-
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
86
|
-
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%
|
|
87
|
-
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%
|
|
88
|
-
|
|
89
|
-
### `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`
|
|
90
|
-
|
|
91
|
-
Adds all (or some) of the above methods. Really messes it up.
|
|
92
|
-
|
|
93
|
-
**Parameters**:
|
|
94
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
95
|
-
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
96
|
-
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1
|
|
97
|
-
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5
|
|
98
|
-
- `sample_size` (int, optional): Number of rows to duplicate. Randomly selected if not specified.
|
|
99
|
-
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%
|
|
100
|
-
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%
|
|
101
|
-
- `introduce_spag` (bool): Adds spelling and grammar errors into string data. Defaults to True
|
|
102
|
-
- `add_outliers` (bool): Adds outliers to numerical data. Defaults to True
|
|
103
|
-
- `add_std` (bool): Adds standard deviations to the data. Defaults to True
|
|
104
|
-
- `duplicate` (bool): Adds duplicate rows to the data. Defaults to True
|
|
105
|
-
- `add_null` (bool): Adds null values to the dataset. Defaults to True
|
complexifier-0.3.1/README.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Complexifier
|
|
2
|
-
|
|
3
|
-
This makes your pandas dataframe even worse
|
|
4
|
-
|
|
5
|
-
## Dependencies
|
|
6
|
-
|
|
7
|
-
- `pandas`
|
|
8
|
-
- `typo`
|
|
9
|
-
- `random`
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
`complexifier` can be installed using `pip`
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
pip install complexifier
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
Once installed you can use `complexifier` to add mistakes and outliers to your data
|
|
22
|
-
|
|
23
|
-
This library has several methods available:
|
|
24
|
-
|
|
25
|
-
### `create_spag_error(word: str) -> str`
|
|
26
|
-
|
|
27
|
-
**Parameters**:
|
|
28
|
-
- `word` (str): The original word to potentially alter.
|
|
29
|
-
|
|
30
|
-
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.
|
|
31
|
-
|
|
32
|
-
### `introduce_spag_error(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
33
|
-
|
|
34
|
-
Applies the create_spag_error function to each string entry in specified columns of a DataFrame, introducing random spelling errors with a 10% probability.
|
|
35
|
-
|
|
36
|
-
**Parameters**:
|
|
37
|
-
- `df` (pd.DataFrame): The DataFrame to alter.
|
|
38
|
-
- `columns` (list or str): Column names to apply errors to. Defaults to all string columns.
|
|
39
|
-
|
|
40
|
-
### `add_or_subtract_outliers(df: pd.DataFrame, columns=None) -> pd.DataFrame`
|
|
41
|
-
|
|
42
|
-
Randomly adds or subtracts values in specified numeric columns at random indices, simulating outliers between 1% and 10% of the rows.
|
|
43
|
-
|
|
44
|
-
**Parameters**:
|
|
45
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
46
|
-
- `columns` (list or str): Column names to adjust. Defaults to all numeric columns if not specified.
|
|
47
|
-
|
|
48
|
-
### `add_standard_deviations(df: pd.DataFrame, columns=None, min_std=1, max_std=5) -> pd.DataFrame`
|
|
49
|
-
|
|
50
|
-
Adds between 1 to 5 standard deviations to random entries in specified numeric columns to simulate data anomalies.
|
|
51
|
-
|
|
52
|
-
**Parameters**:
|
|
53
|
-
- `df` (pd.DataFrame): The DataFrame to manipulate.
|
|
54
|
-
- `columns` (list or str): Column names to modify. Defaults to numeric columns if not specified.
|
|
55
|
-
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1
|
|
56
|
-
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5
|
|
57
|
-
|
|
58
|
-
### `duplicate_rows(df: pd.DataFrame, sample_size=None) -> pd.DataFrame`
|
|
59
|
-
|
|
60
|
-
Introduces duplicate rows into a DataFrame. This function is useful for testing deduplication processes.
|
|
61
|
-
|
|
62
|
-
**Parameters**:
|
|
63
|
-
- `df` (pd.DataFrame): DataFrame to which duplicates will be added.
|
|
64
|
-
- `sample_size` (int): number of rows to duplicate. A random percentage between 1% and 10% if not specified.
|
|
65
|
-
|
|
66
|
-
### `add_nulls(df: pd.DataFrame, columns=None, min_percent=1, max_percent=10) -> pd.DataFrame`
|
|
67
|
-
|
|
68
|
-
Inserts null values into specified DataFrame columns. This simulates missing data conditions.
|
|
69
|
-
|
|
70
|
-
**Parameters**:
|
|
71
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
72
|
-
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
73
|
-
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%
|
|
74
|
-
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%
|
|
75
|
-
|
|
76
|
-
### `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`
|
|
77
|
-
|
|
78
|
-
Adds all (or some) of the above methods. Really messes it up.
|
|
79
|
-
|
|
80
|
-
**Parameters**:
|
|
81
|
-
- `df` (pd.DataFrame): The DataFrame to modify.
|
|
82
|
-
- `columns` (list or str, optional): Specific columns to add nulls to. Defaults to all columns if not specified.
|
|
83
|
-
- `min_std` (int): Minimum number of standard deviations to add. Defaults to 1
|
|
84
|
-
- `max_std` (int): Maximum number of standard deviations to add. Defaults to 5
|
|
85
|
-
- `sample_size` (int, optional): Number of rows to duplicate. Randomly selected if not specified.
|
|
86
|
-
- `min_percent` (int): Minimum percentage of null values to insert. Defaults to 1%
|
|
87
|
-
- `max_percent` (int): Maximum percentage of null values to insert. Defaults to 10%
|
|
88
|
-
- `introduce_spag` (bool): Adds spelling and grammar errors into string data. Defaults to True
|
|
89
|
-
- `add_outliers` (bool): Adds outliers to numerical data. Defaults to True
|
|
90
|
-
- `add_std` (bool): Adds standard deviations to the data. Defaults to True
|
|
91
|
-
- `duplicate` (bool): Adds duplicate rows to the data. Defaults to True
|
|
92
|
-
- `add_null` (bool): Adds null values to the dataset. Defaults to True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|