edapy-tools 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.
- edapy_tools-0.1.0/LICENSE +19 -0
- edapy_tools-0.1.0/PKG-INFO +30 -0
- edapy_tools-0.1.0/README.md +18 -0
- edapy_tools-0.1.0/pyproject.toml +13 -0
- edapy_tools-0.1.0/setup.cfg +4 -0
- edapy_tools-0.1.0/src/edapy/__init__.py +6 -0
- edapy_tools-0.1.0/src/edapy/load_clean.py +23 -0
- edapy_tools-0.1.0/src/edapy/stats.py +51 -0
- edapy_tools-0.1.0/src/edapy/summary.py +41 -0
- edapy_tools-0.1.0/src/edapy_tools.egg-info/PKG-INFO +30 -0
- edapy_tools-0.1.0/src/edapy_tools.egg-info/SOURCES.txt +13 -0
- edapy_tools-0.1.0/src/edapy_tools.egg-info/dependency_links.txt +1 -0
- edapy_tools-0.1.0/src/edapy_tools.egg-info/requires.txt +1 -0
- edapy_tools-0.1.0/src/edapy_tools.egg-info/top_level.txt +1 -0
- edapy_tools-0.1.0/test/test_edapy.py +23 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 Abdulaziz Mohamed
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edapy-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas.
|
|
5
|
+
Author: Abdulaziz Mohamed
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pandas>=1.3.0
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# edapy
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+

|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
**edapy** is a lightweight, zero-boilerplate Python library for fast Exploratory Data Analysis (EDA). Clean datasets, inspect distributions, detect IQR outliers, and export full statistical summaries in a single line of code.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **One-line Load & Clean (`edapy.load`)**: Reads CSV files, removes duplicate rows automatically, reports missing values, and previews the dataset.
|
|
24
|
+
- **Smart Column Stats (`edapy.stats`)**: Computes `sum`, `mean`, `median`, `Q1`, `Q3`, `IQR`, lower/upper bounds, and outlier counts—automatically encoding text/categorical columns into numeric values without throwing errors.
|
|
25
|
+
- **Instant Summary Table (`edapy.summary`)**: Generates a complete EDA summary table across all or selected columns and exports it directly to CSV.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install edapy-tools
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# edapy
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**edapy** is a lightweight, zero-boilerplate Python library for fast Exploratory Data Analysis (EDA). Clean datasets, inspect distributions, detect IQR outliers, and export full statistical summaries in a single line of code.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **One-line Load & Clean (`edapy.load`)**: Reads CSV files, removes duplicate rows automatically, reports missing values, and previews the dataset.
|
|
12
|
+
- **Smart Column Stats (`edapy.stats`)**: Computes `sum`, `mean`, `median`, `Q1`, `Q3`, `IQR`, lower/upper bounds, and outlier counts—automatically encoding text/categorical columns into numeric values without throwing errors.
|
|
13
|
+
- **Instant Summary Table (`edapy.summary`)**: Generates a complete EDA summary table across all or selected columns and exports it directly to CSV.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install edapy-tools
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "edapy-tools"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.7"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Abdulaziz Mohamed" }
|
|
10
|
+
]
|
|
11
|
+
dependencies = [
|
|
12
|
+
"pandas>=1.3.0",
|
|
13
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def load(file_path: str, head_rows: int = 5) -> pd.DataFrame:
|
|
5
|
+
df = pd.read_csv(file_path)
|
|
6
|
+
|
|
7
|
+
dups = int(df.duplicated().sum())
|
|
8
|
+
if dups > 0:
|
|
9
|
+
df = df.drop_duplicates().reset_index(drop=True)
|
|
10
|
+
print(f"Duplicates: {dups} -> Removed.")
|
|
11
|
+
else:
|
|
12
|
+
print("Duplicates: 0 -> Nothing removed.")
|
|
13
|
+
|
|
14
|
+
missing = df.isnull().sum()
|
|
15
|
+
total_missing = int(missing.sum())
|
|
16
|
+
print(f"\nMissing values: {total_missing}")
|
|
17
|
+
if total_missing > 0:
|
|
18
|
+
print(missing[missing > 0])
|
|
19
|
+
|
|
20
|
+
print(f"\nFirst {head_rows} rows:")
|
|
21
|
+
print(df.head(head_rows).to_string(index=False))
|
|
22
|
+
|
|
23
|
+
return df
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _to_numeric(series: pd.Series, col_name: str) -> pd.Series:
|
|
5
|
+
if pd.api.types.is_numeric_dtype(series):
|
|
6
|
+
return series.dropna().astype(float)
|
|
7
|
+
|
|
8
|
+
as_num = pd.to_numeric(series, errors="coerce")
|
|
9
|
+
if as_num.notna().mean() >= 0.8:
|
|
10
|
+
print(f"Note: '{col_name}' converted from text to numeric.")
|
|
11
|
+
return as_num.dropna().astype(float)
|
|
12
|
+
|
|
13
|
+
codes, uniques = pd.factorize(series.dropna(), sort=True)
|
|
14
|
+
mapping = {val: idx for idx, val in enumerate(uniques)}
|
|
15
|
+
print(f"Note: '{col_name}' is text -> encoded to numbers: {mapping}")
|
|
16
|
+
return pd.Series(codes, index=series.dropna().index, dtype=float)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def stats(
|
|
20
|
+
df: pd.DataFrame, column: str, decimals: int = 2, show: bool = True
|
|
21
|
+
) -> dict:
|
|
22
|
+
if column not in df.columns:
|
|
23
|
+
raise KeyError(f"Column '{column}' not found.")
|
|
24
|
+
|
|
25
|
+
s = _to_numeric(df[column], column)
|
|
26
|
+
q1 = s.quantile(0.25)
|
|
27
|
+
median = s.quantile(0.50)
|
|
28
|
+
q3 = s.quantile(0.75)
|
|
29
|
+
iqr = q3 - q1
|
|
30
|
+
lower = q1 - 1.5 * iqr
|
|
31
|
+
upper = q3 + 1.5 * iqr
|
|
32
|
+
outliers = s[(s < lower) | (s > upper)]
|
|
33
|
+
|
|
34
|
+
res = {
|
|
35
|
+
"sum": round(float(s.sum()), decimals),
|
|
36
|
+
"mean": round(float(s.mean()), decimals),
|
|
37
|
+
"median": round(float(median), decimals),
|
|
38
|
+
"q1": round(float(q1), decimals),
|
|
39
|
+
"q3": round(float(q3), decimals),
|
|
40
|
+
"iqr": round(float(iqr), decimals),
|
|
41
|
+
"lower_bound": round(float(lower), decimals),
|
|
42
|
+
"upper_bound": round(float(upper), decimals),
|
|
43
|
+
"outliers_count": int(outliers.count()),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if show:
|
|
47
|
+
print(f"\n--- {column} ---")
|
|
48
|
+
for k, v in res.items():
|
|
49
|
+
print(f"{k}: {v}")
|
|
50
|
+
|
|
51
|
+
return res
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from .stats import stats
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def summary(
|
|
8
|
+
df: pd.DataFrame,
|
|
9
|
+
columns: Optional[List[str]] = None,
|
|
10
|
+
save_path: Optional[str] = "summary.csv",
|
|
11
|
+
decimals: int = 2,
|
|
12
|
+
show: bool = True,
|
|
13
|
+
) -> pd.DataFrame:
|
|
14
|
+
cols = columns if columns is not None else list(df.columns)
|
|
15
|
+
rows = []
|
|
16
|
+
|
|
17
|
+
for col in cols:
|
|
18
|
+
res = stats(df, col, decimals=decimals, show=False)
|
|
19
|
+
rows.append({
|
|
20
|
+
"Column": col,
|
|
21
|
+
"Total": res["sum"],
|
|
22
|
+
"Mean": res["mean"],
|
|
23
|
+
"Median": res["median"],
|
|
24
|
+
"Q1": res["q1"],
|
|
25
|
+
"Q3": res["q3"],
|
|
26
|
+
"IQR": res["iqr"],
|
|
27
|
+
"Lower_Bound": res["lower_bound"],
|
|
28
|
+
"Upper_Bound": res["upper_bound"],
|
|
29
|
+
"Outliers": res["outliers_count"],
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
out = pd.DataFrame(rows)
|
|
33
|
+
|
|
34
|
+
if save_path:
|
|
35
|
+
out.to_csv(save_path, index=False)
|
|
36
|
+
print(f"Summary CSV saved to: {save_path}")
|
|
37
|
+
|
|
38
|
+
if show:
|
|
39
|
+
print(out.to_string(index=False))
|
|
40
|
+
|
|
41
|
+
return out
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edapy-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas.
|
|
5
|
+
Author: Abdulaziz Mohamed
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pandas>=1.3.0
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# edapy
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+

|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
**edapy** is a lightweight, zero-boilerplate Python library for fast Exploratory Data Analysis (EDA). Clean datasets, inspect distributions, detect IQR outliers, and export full statistical summaries in a single line of code.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **One-line Load & Clean (`edapy.load`)**: Reads CSV files, removes duplicate rows automatically, reports missing values, and previews the dataset.
|
|
24
|
+
- **Smart Column Stats (`edapy.stats`)**: Computes `sum`, `mean`, `median`, `Q1`, `Q3`, `IQR`, lower/upper bounds, and outlier counts—automatically encoding text/categorical columns into numeric values without throwing errors.
|
|
25
|
+
- **Instant Summary Table (`edapy.summary`)**: Generates a complete EDA summary table across all or selected columns and exports it directly to CSV.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install edapy-tools
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/edapy/__init__.py
|
|
5
|
+
src/edapy/load_clean.py
|
|
6
|
+
src/edapy/stats.py
|
|
7
|
+
src/edapy/summary.py
|
|
8
|
+
src/edapy_tools.egg-info/PKG-INFO
|
|
9
|
+
src/edapy_tools.egg-info/SOURCES.txt
|
|
10
|
+
src/edapy_tools.egg-info/dependency_links.txt
|
|
11
|
+
src/edapy_tools.egg-info/requires.txt
|
|
12
|
+
src/edapy_tools.egg-info/top_level.txt
|
|
13
|
+
test/test_edapy.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pandas>=1.3.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edapy
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import edapy
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_stats_numeric():
|
|
6
|
+
df = pd.DataFrame({"score": [10, 20, 30, 40, 100]})
|
|
7
|
+
res = edapy.stats(df, "score", show=False)
|
|
8
|
+
assert res["median"] == 30.0
|
|
9
|
+
assert res["outliers_count"] == 1
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_stats_categorical_auto_encode():
|
|
13
|
+
df = pd.DataFrame({"grade": ["A", "B", "A", "C"]})
|
|
14
|
+
res = edapy.stats(df, "grade", show=False)
|
|
15
|
+
assert res["mean"] == 0.75
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_summary_table(tmp_path):
|
|
19
|
+
df = pd.DataFrame({"a": [1, 2, 3], "b": [10, 20, 30]})
|
|
20
|
+
out_file = tmp_path / "out.csv"
|
|
21
|
+
table = edapy.summary(df, save_path=str(out_file), show=False)
|
|
22
|
+
assert len(table) == 2
|
|
23
|
+
assert out_file.exists()
|