etl-agent 0.0.1__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.
etl_agent-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 abhimanyuawarrior
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
etl_agent-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: etl_agent
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A small example package
|
|
5
|
+
Project-URL: Homepage, https://github.com/abhimanyuawarrior/data_cleaner
|
|
6
|
+
Project-URL: Issues, https://github.com/abhimanyuawarrior/data_cleaner/issues
|
|
7
|
+
Author-email: Satyam Dubey <satyamthesupreme@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Requires-Dist: pandas>=2.0
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# data-cleaner
|
|
17
|
+
|
|
18
|
+
A small Python package for basic dataset cleaning.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install etl_agent
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import pandas as pd
|
|
30
|
+
from data_cleaner import transform_data
|
|
31
|
+
|
|
32
|
+
df = pd.read_csv("data.csv")
|
|
33
|
+
cleaned_df, report = transform_data(df)
|
|
34
|
+
|
|
35
|
+
print(cleaned_df)
|
|
36
|
+
print(report)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- Detect and remove exact duplicate rows
|
|
42
|
+
- Fill missing numerical values with the column median
|
|
43
|
+
- Fill missing non-numerical values with `"Unknown"`
|
|
44
|
+
- Return a cleaning action report
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
Install the build tools:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m pip install --upgrade build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Build the package:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python -m build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The distribution files will be created in the `dist/` directory.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
Add your chosen `LICENSE` file here before publishing.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# data-cleaner
|
|
2
|
+
|
|
3
|
+
A small Python package for basic dataset cleaning.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install etl_agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import pandas as pd
|
|
15
|
+
from data_cleaner import transform_data
|
|
16
|
+
|
|
17
|
+
df = pd.read_csv("data.csv")
|
|
18
|
+
cleaned_df, report = transform_data(df)
|
|
19
|
+
|
|
20
|
+
print(cleaned_df)
|
|
21
|
+
print(report)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- Detect and remove exact duplicate rows
|
|
27
|
+
- Fill missing numerical values with the column median
|
|
28
|
+
- Fill missing non-numerical values with `"Unknown"`
|
|
29
|
+
- Return a cleaning action report
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
|
|
33
|
+
Install the build tools:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m pip install --upgrade build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Build the package:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The distribution files will be created in the `dist/` directory.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
Add your chosen `LICENSE` file here before publishing.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "etl_agent"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Satyam Dubey", email = "satyamthesupreme@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "A small example package"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
dependencies = ["pandas>=2.0"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
license = "MIT"
|
|
20
|
+
license-files = ["LICEN[CS]E*"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/abhimanyuawarrior/data_cleaner"
|
|
24
|
+
Issues = "https://github.com/abhimanyuawarrior/data_cleaner/issues"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/data_cleaner"]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
#BY Satyam Dubey
|
|
4
|
+
def transform_data(df, auto_repair=True):
|
|
5
|
+
"""
|
|
6
|
+
Remove exact duplicate rows and handle missing values.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
df : pandas.DataFrame
|
|
11
|
+
Dataset to clean.
|
|
12
|
+
auto_repair : bool, default=True
|
|
13
|
+
If True, apply repairs. If False, only report detected issues.
|
|
14
|
+
|
|
15
|
+
Returns
|
|
16
|
+
-------
|
|
17
|
+
tuple[pandas.DataFrame, list[dict]]
|
|
18
|
+
Cleaned (or unchanged) DataFrame and a list of cleaning actions.
|
|
19
|
+
"""
|
|
20
|
+
out = df.copy()
|
|
21
|
+
actions = []
|
|
22
|
+
|
|
23
|
+
# Check and optionally remove exact duplicate rows.
|
|
24
|
+
dup = int(out.duplicated().sum())
|
|
25
|
+
|
|
26
|
+
if dup and auto_repair:
|
|
27
|
+
out = out.drop_duplicates()
|
|
28
|
+
actions.append({
|
|
29
|
+
"action": "Remove exact duplicate rows",
|
|
30
|
+
"affected": dup,
|
|
31
|
+
"status": "applied",
|
|
32
|
+
})
|
|
33
|
+
else:
|
|
34
|
+
actions.append({
|
|
35
|
+
"action": "Duplicate row check",
|
|
36
|
+
"affected": dup,
|
|
37
|
+
"status": "reported",
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
# Fill missing values in numerical columns with the column median.
|
|
41
|
+
for col in out.select_dtypes(include="number").columns:
|
|
42
|
+
missing = int(out[col].isna().sum())
|
|
43
|
+
|
|
44
|
+
if missing and auto_repair:
|
|
45
|
+
median = out[col].median()
|
|
46
|
+
if pd.notna(median):
|
|
47
|
+
out[col] = out[col].fillna(median)
|
|
48
|
+
actions.append({
|
|
49
|
+
"action": f"Fill missing {col} with median",
|
|
50
|
+
"affected": missing,
|
|
51
|
+
"status": "applied",
|
|
52
|
+
})
|
|
53
|
+
elif missing:
|
|
54
|
+
actions.append({
|
|
55
|
+
"action": f"Missing values in {col}",
|
|
56
|
+
"affected": missing,
|
|
57
|
+
"status": "reported",
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
# Fill missing values in non-numerical columns with "Unknown".
|
|
61
|
+
for col in out.select_dtypes(exclude="number").columns:
|
|
62
|
+
missing = int(out[col].isna().sum())
|
|
63
|
+
|
|
64
|
+
if missing and auto_repair:
|
|
65
|
+
out[col] = out[col].fillna("Unknown")
|
|
66
|
+
actions.append({
|
|
67
|
+
"action": f"Fill missing {col} with Unknown",
|
|
68
|
+
"affected": missing,
|
|
69
|
+
"status": "applied",
|
|
70
|
+
})
|
|
71
|
+
elif missing:
|
|
72
|
+
actions.append({
|
|
73
|
+
"action": f"Missing values in {col}",
|
|
74
|
+
"affected": missing,
|
|
75
|
+
"status": "reported",
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
actions.append({
|
|
79
|
+
"action": "Rows after ETL",
|
|
80
|
+
"affected": len(out),
|
|
81
|
+
"status": "complete",
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return out, actions
|