dfcleanerpro 0.1.0__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.
- dfcleanerpro-0.1.0/LICENSE +21 -0
- dfcleanerpro-0.1.0/PKG-INFO +19 -0
- dfcleanerpro-0.1.0/README.md +26 -0
- dfcleanerpro-0.1.0/dfcleanerpro/__init__.py +3 -0
- dfcleanerpro-0.1.0/dfcleanerpro/cleaner.py +29 -0
- dfcleanerpro-0.1.0/dfcleanerpro/utils.py +2 -0
- dfcleanerpro-0.1.0/dfcleanerpro.egg-info/PKG-INFO +19 -0
- dfcleanerpro-0.1.0/dfcleanerpro.egg-info/SOURCES.txt +13 -0
- dfcleanerpro-0.1.0/dfcleanerpro.egg-info/dependency_links.txt +1 -0
- dfcleanerpro-0.1.0/dfcleanerpro.egg-info/requires.txt +1 -0
- dfcleanerpro-0.1.0/dfcleanerpro.egg-info/top_level.txt +1 -0
- dfcleanerpro-0.1.0/pyproject.toml +3 -0
- dfcleanerpro-0.1.0/setup.cfg +4 -0
- dfcleanerpro-0.1.0/setup.py +21 -0
- dfcleanerpro-0.1.0/tests/test_cleaner.py +45 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nishanth K
|
|
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.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dfcleanerpro
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simple DataFrame cleaning toolkit
|
|
5
|
+
Home-page: https://github.com/Nishanth9696/dfcleaner
|
|
6
|
+
Author: Nishanth K
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
Dynamic: requires-dist
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
Dynamic: summary
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# **dfcleaner**
|
|
2
|
+
|
|
3
|
+
**dfcleaner** is a simple Python library to clean Pandas DataFrames quickly.
|
|
4
|
+
|
|
5
|
+
**Features**
|
|
6
|
+
- Remove duplicates
|
|
7
|
+
- Convert column names to snake_case
|
|
8
|
+
- Fill missing values
|
|
9
|
+
|
|
10
|
+
**Installation**
|
|
11
|
+
|
|
12
|
+
pip install dfcleaner
|
|
13
|
+
|
|
14
|
+
**Example**
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
import pandas as pd
|
|
18
|
+
from dfcleaner import clean_dataframe
|
|
19
|
+
|
|
20
|
+
df = pd.read_csv("data.csv")
|
|
21
|
+
|
|
22
|
+
df = clean_dataframe(df, fill_missing="mean")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**License**<br>
|
|
26
|
+
MIT License
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
def clean_dataframe(
|
|
4
|
+
df,
|
|
5
|
+
drop_duplicates=True,
|
|
6
|
+
snake_case_columns=True,
|
|
7
|
+
fill_missing=None
|
|
8
|
+
):
|
|
9
|
+
df = df.copy()
|
|
10
|
+
|
|
11
|
+
# Drop duplicates
|
|
12
|
+
if drop_duplicates:
|
|
13
|
+
df = df.drop_duplicates()
|
|
14
|
+
|
|
15
|
+
# Convert column names to snake_case
|
|
16
|
+
if snake_case_columns:
|
|
17
|
+
df.columns = [
|
|
18
|
+
col.strip().lower().replace(" ", "_")
|
|
19
|
+
for col in df.columns
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
# Fill missing values
|
|
23
|
+
if fill_missing == "zero":
|
|
24
|
+
df = df.fillna(0)
|
|
25
|
+
|
|
26
|
+
elif fill_missing == "mean":
|
|
27
|
+
df = df.fillna(df.mean(numeric_only=True))
|
|
28
|
+
|
|
29
|
+
return df
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dfcleanerpro
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Simple DataFrame cleaning toolkit
|
|
5
|
+
Home-page: https://github.com/Nishanth9696/dfcleaner
|
|
6
|
+
Author: Nishanth K
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
Dynamic: requires-dist
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
Dynamic: summary
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
dfcleanerpro/__init__.py
|
|
6
|
+
dfcleanerpro/cleaner.py
|
|
7
|
+
dfcleanerpro/utils.py
|
|
8
|
+
dfcleanerpro.egg-info/PKG-INFO
|
|
9
|
+
dfcleanerpro.egg-info/SOURCES.txt
|
|
10
|
+
dfcleanerpro.egg-info/dependency_links.txt
|
|
11
|
+
dfcleanerpro.egg-info/requires.txt
|
|
12
|
+
dfcleanerpro.egg-info/top_level.txt
|
|
13
|
+
tests/test_cleaner.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pandas
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dfcleanerpro
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="dfcleanerpro",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
author="Nishanth K",
|
|
7
|
+
description="Simple DataFrame cleaning toolkit",
|
|
8
|
+
Long_description=open('README.md').read(),
|
|
9
|
+
Long_description_content_type='text/markdown',
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
url='https://github.com/Nishanth9696/dfcleaner',
|
|
12
|
+
classifiers=[
|
|
13
|
+
'Programming Language :: Python :: 3',
|
|
14
|
+
'License :: OSI Approved :: MIT License',
|
|
15
|
+
'Operating System :: OS Independent',
|
|
16
|
+
],
|
|
17
|
+
install_requires=[
|
|
18
|
+
"pandas"
|
|
19
|
+
],
|
|
20
|
+
python_requires=">=3.8",
|
|
21
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from dfcleanerpro import clean_dataframe
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_drop_duplicates():
|
|
6
|
+
df = pd.DataFrame({
|
|
7
|
+
"name": ["Alice", "Alice", "Bob"],
|
|
8
|
+
"age": [25, 25, 30]
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
result = clean_dataframe(df, drop_duplicates=True)
|
|
12
|
+
|
|
13
|
+
assert len(result) == 2
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_snake_case_columns():
|
|
17
|
+
df = pd.DataFrame({
|
|
18
|
+
"First Name": ["Alice"],
|
|
19
|
+
"Last Name": ["Smith"]
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
result = clean_dataframe(df, snake_case_columns=True)
|
|
23
|
+
|
|
24
|
+
assert "first_name" in result.columns
|
|
25
|
+
assert "last_name" in result.columns
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_fill_missing_zero():
|
|
29
|
+
df = pd.DataFrame({
|
|
30
|
+
"age": [25, None, 30]
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
result = clean_dataframe(df, fill_missing="zero")
|
|
34
|
+
|
|
35
|
+
assert result["age"].isnull().sum() == 0
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_fill_missing_mean():
|
|
39
|
+
df = pd.DataFrame({
|
|
40
|
+
"age": [20, None, 40]
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
result = clean_dataframe(df, fill_missing="mean")
|
|
44
|
+
|
|
45
|
+
assert result["age"].isnull().sum() == 0
|