analystkit 0.1.0__py3-none-any.whl
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.
analystkit/__init__.py
ADDED
|
File without changes
|
analystkit/reports.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
from pandas import read_csv
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# show reports in terminal
|
|
5
|
+
def generate_reports(files: dict):
|
|
6
|
+
import io
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
for name, file in files.items():
|
|
10
|
+
|
|
11
|
+
df = pd.read_csv(file)
|
|
12
|
+
|
|
13
|
+
buffer = io.StringIO()
|
|
14
|
+
df.info(buf=buffer)
|
|
15
|
+
|
|
16
|
+
print(f"\n{'=' * 50}")
|
|
17
|
+
print(f"DATA REPORT : {name}")
|
|
18
|
+
print(f"{'=' * 50}")
|
|
19
|
+
|
|
20
|
+
# Dataset Overview
|
|
21
|
+
print(f"\nRows: {df.shape[0]}")
|
|
22
|
+
print(f"Columns: {df.shape[1]}")
|
|
23
|
+
|
|
24
|
+
# Duplicate Analysis
|
|
25
|
+
print(f"\nDuplicate Rows: {df.duplicated().sum()}")
|
|
26
|
+
|
|
27
|
+
# Null Analysis
|
|
28
|
+
total_nulls = df.isnull().sum().sum()
|
|
29
|
+
total_cells = df.shape[0] * df.shape[1]
|
|
30
|
+
|
|
31
|
+
null_percentage = (
|
|
32
|
+
total_nulls / total_cells * 100
|
|
33
|
+
if total_cells > 0 else 0
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
print(f"Missing Values: {total_nulls}")
|
|
37
|
+
print(f"Missing Value Percentage: {null_percentage:.2f}%")
|
|
38
|
+
|
|
39
|
+
# Memory Usage Analysis
|
|
40
|
+
memory_usage = (
|
|
41
|
+
df.memory_usage(deep=True).sum()
|
|
42
|
+
/ 1024**2
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
print(f"Memory Usage: {memory_usage:.2f} MB")
|
|
46
|
+
|
|
47
|
+
# Column Information
|
|
48
|
+
print("\nColumn Names:")
|
|
49
|
+
print(df.columns.tolist())
|
|
50
|
+
|
|
51
|
+
# Data Type Analysis
|
|
52
|
+
print("\nData Types:")
|
|
53
|
+
print(df.dtypes)
|
|
54
|
+
|
|
55
|
+
# Data Information
|
|
56
|
+
print("\nData Information:")
|
|
57
|
+
print(buffer.getvalue())
|
|
58
|
+
|
|
59
|
+
# Statistical Summary
|
|
60
|
+
print("\nStatistical Summary:")
|
|
61
|
+
print(df.describe(include="all"))
|
|
62
|
+
|
|
63
|
+
# Sample Data
|
|
64
|
+
print("\nSample Data:")
|
|
65
|
+
print(df.sample(min(3, len(df))))
|
|
66
|
+
|
|
67
|
+
print(f"\n{'=' * 50}")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# save reports as text_file
|
|
71
|
+
def save_reports(files: dict, filename="report.txt"):
|
|
72
|
+
import io
|
|
73
|
+
import pandas as pd
|
|
74
|
+
|
|
75
|
+
with open(filename, "w", encoding="utf-8") as f:
|
|
76
|
+
|
|
77
|
+
for name, file in files.items():
|
|
78
|
+
|
|
79
|
+
df = pd.read_csv(file)
|
|
80
|
+
|
|
81
|
+
total_nulls = df.isnull().sum().sum()
|
|
82
|
+
total_cells = df.shape[0] * df.shape[1]
|
|
83
|
+
|
|
84
|
+
null_percentage = (
|
|
85
|
+
total_nulls / total_cells * 100
|
|
86
|
+
if total_cells > 0 else 0
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
memory_usage = (
|
|
90
|
+
df.memory_usage(deep=True).sum()
|
|
91
|
+
/ 1024**2
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
f.write(f"\n{'=' * 60}\n")
|
|
95
|
+
f.write(f"DATA REPORT OF {name}\n")
|
|
96
|
+
f.write(f"{'=' * 60}\n")
|
|
97
|
+
|
|
98
|
+
# Dataset Overview
|
|
99
|
+
f.write(f"\nTotal Rows: {df.shape[0]}\n")
|
|
100
|
+
f.write(f"Total Columns: {df.shape[1]}\n")
|
|
101
|
+
|
|
102
|
+
# Duplicate Analysis
|
|
103
|
+
f.write(f"\nTotal Duplicates: {df.duplicated().sum()}\n")
|
|
104
|
+
|
|
105
|
+
# Null Analysis
|
|
106
|
+
f.write(f"\nTotal Missing Values: {total_nulls}\n")
|
|
107
|
+
f.write(
|
|
108
|
+
f"Missing Value Percentage: "
|
|
109
|
+
f"{null_percentage:.2f}%\n"
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Memory Usage
|
|
113
|
+
f.write(
|
|
114
|
+
f"Memory Usage: "
|
|
115
|
+
f"{memory_usage:.2f} MB\n"
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Column Names
|
|
119
|
+
f.write("\nColumn Names:\n")
|
|
120
|
+
f.write("\n".join(df.columns.astype(str)))
|
|
121
|
+
f.write("\n")
|
|
122
|
+
|
|
123
|
+
# Data Types
|
|
124
|
+
f.write("\nData Types:\n")
|
|
125
|
+
f.write(df.dtypes.to_string())
|
|
126
|
+
f.write("\n")
|
|
127
|
+
|
|
128
|
+
# Missing Values By Column
|
|
129
|
+
f.write("\nMissing Values By Column:\n")
|
|
130
|
+
f.write(df.isnull().sum().to_string())
|
|
131
|
+
f.write("\n")
|
|
132
|
+
|
|
133
|
+
# Data Info
|
|
134
|
+
f.write("\nData Information:\n")
|
|
135
|
+
buffer = io.StringIO()
|
|
136
|
+
df.info(buf=buffer)
|
|
137
|
+
f.write(buffer.getvalue())
|
|
138
|
+
|
|
139
|
+
# Statistics
|
|
140
|
+
f.write("\nStatistical Summary:\n")
|
|
141
|
+
f.write(
|
|
142
|
+
df.describe(include="all")
|
|
143
|
+
.to_string()
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Sample Data
|
|
147
|
+
f.write("\n\nSample Data:\n")
|
|
148
|
+
f.write(
|
|
149
|
+
df.sample(min(5, len(df)))
|
|
150
|
+
.to_string()
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
f.write(f"\n\n{'=' * 60}\n")
|
|
154
|
+
|
|
155
|
+
print(
|
|
156
|
+
f"✅ Report saved successfully in {filename}"
|
|
157
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: analystkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python library for data profiling and dataset reporting.
|
|
5
|
+
Author: hasansayyed
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# AnalystKit 📊
|
|
10
|
+
|
|
11
|
+
AnalystKit is a Python library for quick data profiling and dataset reporting. Generate detailed reports for CSV files with a single function call.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Dataset Overview
|
|
16
|
+
- Column Information
|
|
17
|
+
- Data Type Analysis
|
|
18
|
+
- Null Value Report
|
|
19
|
+
- Missing Value Percentage
|
|
20
|
+
- Duplicate Detection
|
|
21
|
+
- Statistical Summary
|
|
22
|
+
- Memory Usage Analysis
|
|
23
|
+
- Sample Data Preview
|
|
24
|
+
- Save Reports to TXT
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install analystkit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from analystkit import generate_reports
|
|
36
|
+
|
|
37
|
+
files = {
|
|
38
|
+
"employees": "employees.csv",
|
|
39
|
+
"sales": "sales.csv"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
generate_reports(files)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Save Report
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from analystkit import save_reports
|
|
49
|
+
|
|
50
|
+
save_reports(files, "report.txt")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Author
|
|
54
|
+
hasansayyed
|
|
55
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
analystkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
analystkit/reports.py,sha256=FJBtSne0WtNtxCf_Hl81qK7T5b5Lat9bBBzLGgAvYNk,4227
|
|
3
|
+
analystkit-0.1.0.dist-info/METADATA,sha256=40iTuSrAwsts9RQlCn55kdcnrlHOyV5rgSz5V5DC_jw,1001
|
|
4
|
+
analystkit-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
analystkit-0.1.0.dist-info/top_level.txt,sha256=iMwy5gs4d-qS4VBhHGxBcHKu6j2rUUf-NhKP2fxz27o,11
|
|
6
|
+
analystkit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
analystkit
|