EDAeasy 1.0.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.
EDAeasy/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ # Version
2
+ __version__ = '1.0.0'
3
+
4
+ # Importing
5
+ from .functions import *
6
+
EDAeasy/config.toml ADDED
File without changes
EDAeasy/functions.py ADDED
@@ -0,0 +1,78 @@
1
+ import pandas as pd
2
+
3
+ def dataframe_summary(dataframe: pd.DataFrame):
4
+ """Generate a summary DataFrame of the input DataFrame 'dataframe'.
5
+
6
+ Parameters
7
+ ----------
8
+ dataframe : pandas.DataFrame
9
+ The input DataFrame for which the summary needs to be generated.
10
+
11
+ Returns
12
+ -------
13
+ pandas.DataFrame
14
+ A DataFrame containing summary information for each column in 'df':
15
+ - Type: Data type of the column.
16
+ - Min: Minimum value in the column.
17
+ - Max: Maximum value in the column.
18
+ - Nan %: Percentage of NaN values in the column.
19
+ - # Unique Values: Total number of unique values in the column.
20
+ - Unique values: List of unique values in the column.
21
+
22
+ Example
23
+ -------
24
+ >>> data = {
25
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
26
+ 'time_in_hospital': [8, 3, 5],
27
+ 'n_lab_procedures': [72, 34, 45],
28
+ ...
29
+ }
30
+ >>> dataframe = pd.DataFrame(data)
31
+ >>> result = dataframe_summary(df)
32
+ >>> print(result)
33
+ Type Min Max Nan % # Unique Values Unique values
34
+ Variables
35
+ age object [40-50) [90-100) 0.0 3 ['[70-80)', '[50-60)', '[60-70)', '[40-50)', '[80-90)', ...
36
+ time_in_hospital int64 1 14 0.0 3 [8, 3, 5]
37
+ n_lab_procedures int64 1 113 0.0 3 [72, 34, 45]
38
+ ...
39
+
40
+ Note
41
+ ----
42
+ The function uses vectorized operations to improve performance and memory usage.
43
+ """
44
+ ret = pd.DataFrame(columns=['Type', 'Min', 'Max', 'Nan %', '# Unique Values', 'Unique values'])
45
+
46
+ for col, content in dataframe.items():
47
+ values = []
48
+ dtype = content.dtype
49
+
50
+ # Convert 'object' columns to appropriate data types
51
+ if dtype == 'object':
52
+ if col in ['Min', 'Max', 'Type']:
53
+ # Clean and convert 'Min', 'Max', and 'Type' columns to strings
54
+ content = content.astype(str)
55
+
56
+ values.append(content.dtype) # Data type after conversion
57
+
58
+ try:
59
+ values.append(content.min()) # Min
60
+ values.append(content.max()) # Max
61
+ except Exception:
62
+ values.append('None')
63
+ values.append('None')
64
+
65
+ values.append(content.isnull().mean() * 100) # % of NaN's
66
+ # Calculate the number of unique values in the column
67
+ num_unique_values = len(content.drop_duplicates())
68
+ values.append(num_unique_values) # Number of unique values
69
+ # Handle the 'Unique values' column as a list of strings
70
+ unique_values = content.drop_duplicates().astype(str).tolist()
71
+ unique_values.sort()
72
+ values.append(unique_values)
73
+ ret.loc[col] = values
74
+
75
+ ret.index.names = ['Variables']
76
+ rows = dataframe.shape[0]
77
+ columns = dataframe.shape[1]
78
+ return ret, (rows, columns)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
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,97 @@
1
+ Metadata-Version: 2.1
2
+ Name: EDAeasy
3
+ Version: 1.0.0
4
+ Summary: Functions and tools for making Exploratory Data Analysis easy!
5
+ Author-email: Francisco Ocazionez-Cardozo <focazionez@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) [year] [fullname]
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Keywords: Exploratory Data Analysis,EDA,Data
28
+ Classifier: License :: OSI Approved :: MIT License
29
+ Classifier: Programming Language :: Python
30
+ Classifier: Programming Language :: Python :: 3
31
+ Requires-Python: >=3.10
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: numpy (>=1.25.1)
35
+ Requires-Dist: pandas (>=2.0.3)
36
+ Requires-Dist: python-dateutil (>=2.8.2)
37
+ Requires-Dist: pytz (>=2023.3)
38
+ Requires-Dist: six (>=1.16.0)
39
+ Requires-Dist: tzdata (>=2023.3)
40
+ Provides-Extra: dev
41
+ Requires-Dist: black ; extra == 'dev'
42
+ Requires-Dist: bumpver ; extra == 'dev'
43
+ Requires-Dist: isort ; extra == 'dev'
44
+ Requires-Dist: pip-tools ; extra == 'dev'
45
+ Requires-Dist: pytest ; extra == 'dev'
46
+
47
+ # EDAeasy 😀
48
+ The package for quick exploratory data analysis
49
+
50
+
51
+ ## Instalation
52
+
53
+ `pip install EDAeasy`
54
+
55
+ ## Usage
56
+ The **dataframe_summary** function have relative simple summary of the columns of your dataframe
57
+ for quick look at tabular data
58
+
59
+ Generate a summary DataFrame of the input DataFrame 'dataframe'.
60
+
61
+ Parameters
62
+ ----------
63
+ dataframe : pandas.DataFrame
64
+ The input DataFrame for which the summary needs to be generated.
65
+
66
+ Returns
67
+ -------
68
+ pandas.DataFrame
69
+ A DataFrame containing summary information for each column in 'df':
70
+ - Type: Data type of the column.
71
+ - Min: Minimum value in the column.
72
+ - Max: Maximum value in the column.
73
+ - Nan %: Percentage of NaN values in the column.
74
+ - # Unique Values: Total number of unique values in the column.
75
+ - Unique values: List of unique values in the column.
76
+
77
+ Example
78
+ -------
79
+ >>> data = {
80
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
81
+ 'time_in_hospital': [8, 3, 5],
82
+ 'n_lab_procedures': [72, 34, 45],
83
+ ...
84
+ }
85
+ >>> dataframe = pd.DataFrame(data)
86
+ >>> result = dataframe_summary(df)
87
+ >>> print(result)
88
+ Type Min Max Nan % # Unique Values Unique values
89
+ Variables
90
+ age object [40-50) [90-100) 0.0 3 ['[70-80)', '[50-60)', '[60-70)', '[40-50)', '[80-90)', ...
91
+ time_in_hospital int64 1 14 0.0 3 [8, 3, 5]
92
+ n_lab_procedures int64 1 113 0.0 3 [72, 34, 45]
93
+ ...
94
+
95
+ Note
96
+ ----
97
+ The function uses vectorized operations to improve performance and memory usage.
@@ -0,0 +1,8 @@
1
+ EDAeasy/__init__.py,sha256=ZUIgIq7T10orfqVP0um6YTOE5_-Vmc1UlofgP3NYTl0,71
2
+ EDAeasy/config.toml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ EDAeasy/functions.py,sha256=TbsWanvNGTvvVpLLSKzSkiClyRnq60MBIHcm8C_0gD8,3022
4
+ EDAeasy-1.0.0.dist-info/LICENSE,sha256=pAZXnNE2dxxwXFIduGyn1gpvPefJtUYOYZOi3yeGG94,1068
5
+ EDAeasy-1.0.0.dist-info/METADATA,sha256=11Y1KYGvpIifb87JxfPDO-uasQXBucEyE1FFgnnCprY,3951
6
+ EDAeasy-1.0.0.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
7
+ EDAeasy-1.0.0.dist-info/top_level.txt,sha256=HqmFuRclSfgxacHSdzpiOdwVuAboC28f8OEBXLJqsPc,8
8
+ EDAeasy-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ EDAeasy