edapy-tools 0.1.0__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edapy-tools
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas.
5
5
  Author: Abdulaziz Mohamed
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "edapy-tools"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.7"
@@ -2,5 +2,5 @@ from .load_clean import load
2
2
  from .stats import stats
3
3
  from .summary import summary
4
4
 
5
- __version__ = "0.1.0"
5
+ __version__ = "0.1.2"
6
6
  __all__ = ["load", "stats", "summary"]
@@ -0,0 +1,34 @@
1
+ from __future__ import annotations
2
+ import pandas as pd
3
+
4
+
5
+ def load(
6
+ file_path: str, preview: bool = False, head_rows: int = 5
7
+ ) -> pd.DataFrame:
8
+ df = pd.read_csv(file_path)
9
+
10
+ dups = int(df.duplicated().sum())
11
+ if dups > 0:
12
+ df = df.drop_duplicates().reset_index(drop=True)
13
+ print(f"Duplicates: {dups} -> Removed.")
14
+ else:
15
+ print("Duplicates: 0 -> Nothing removed.")
16
+
17
+ missing = df.isnull().sum()
18
+ total_missing = int(missing.sum())
19
+ print(f"Missing values: {total_missing}")
20
+ if total_missing > 0:
21
+ print(missing[missing > 0])
22
+
23
+ print(f"Shape: {df.shape[0]} rows x {df.shape[1]} columns")
24
+
25
+ if preview:
26
+ short_df = df.head(head_rows).copy()
27
+ short_df.columns = [
28
+ f"{str(c)[:18]}..." if len(str(c)) > 20 else str(c)
29
+ for c in short_df.columns
30
+ ]
31
+ print(f"\nPreview (first {head_rows} rows):")
32
+ print(short_df.to_string(index=False, max_cols=5))
33
+
34
+ return df
@@ -33,9 +33,14 @@ def summary(
33
33
 
34
34
  if save_path:
35
35
  out.to_csv(save_path, index=False)
36
- print(f"Summary CSV saved to: {save_path}")
36
+ print(f"\nSummary CSV saved to: {save_path}")
37
37
 
38
38
  if show:
39
- print(out.to_string(index=False))
39
+ max_len = int(out["Column"].astype(str).str.len().max())
40
+ fmt = {"Column": lambda x: f"{str(x):<{max_len}} "}
41
+ print()
42
+ print(
43
+ out.to_string(index=False, justify="left", col_space=3, formatters=fmt)
44
+ )
40
45
 
41
46
  return out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edapy-tools
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Fast, lightweight, and intuitive Exploratory Data Analysis (EDA) toolkit for pandas.
5
5
  Author: Abdulaziz Mohamed
6
6
  License: MIT
@@ -1,23 +0,0 @@
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
File without changes
File without changes
File without changes