EDAeasy 1.0.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.
EDAeasy-1.0.0/LICENSE ADDED
@@ -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 @@
1
+ include src/EDAeasy/*.toml
EDAeasy-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,86 @@
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
+ Provides-Extra: dev
34
+ License-File: LICENSE
35
+
36
+ # EDAeasy 😀
37
+ The package for quick exploratory data analysis
38
+
39
+
40
+ ## Instalation
41
+
42
+ `pip install EDAeasy`
43
+
44
+ ## Usage
45
+ The **dataframe_summary** function have relative simple summary of the columns of your dataframe
46
+ for quick look at tabular data
47
+
48
+ Generate a summary DataFrame of the input DataFrame 'dataframe'.
49
+
50
+ Parameters
51
+ ----------
52
+ dataframe : pandas.DataFrame
53
+ The input DataFrame for which the summary needs to be generated.
54
+
55
+ Returns
56
+ -------
57
+ pandas.DataFrame
58
+ A DataFrame containing summary information for each column in 'df':
59
+ - Type: Data type of the column.
60
+ - Min: Minimum value in the column.
61
+ - Max: Maximum value in the column.
62
+ - Nan %: Percentage of NaN values in the column.
63
+ - # Unique Values: Total number of unique values in the column.
64
+ - Unique values: List of unique values in the column.
65
+
66
+ Example
67
+ -------
68
+ >>> data = {
69
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
70
+ 'time_in_hospital': [8, 3, 5],
71
+ 'n_lab_procedures': [72, 34, 45],
72
+ ...
73
+ }
74
+ >>> dataframe = pd.DataFrame(data)
75
+ >>> result = dataframe_summary(df)
76
+ >>> print(result)
77
+ Type Min Max Nan % # Unique Values Unique values
78
+ Variables
79
+ age object [40-50) [90-100) 0.0 3 ['[70-80)', '[50-60)', '[60-70)', '[40-50)', '[80-90)', ...
80
+ time_in_hospital int64 1 14 0.0 3 [8, 3, 5]
81
+ n_lab_procedures int64 1 113 0.0 3 [72, 34, 45]
82
+ ...
83
+
84
+ Note
85
+ ----
86
+ The function uses vectorized operations to improve performance and memory usage.
@@ -0,0 +1,51 @@
1
+ # EDAeasy 😀
2
+ The package for quick exploratory data analysis
3
+
4
+
5
+ ## Instalation
6
+
7
+ `pip install EDAeasy`
8
+
9
+ ## Usage
10
+ The **dataframe_summary** function have relative simple summary of the columns of your dataframe
11
+ for quick look at tabular data
12
+
13
+ Generate a summary DataFrame of the input DataFrame 'dataframe'.
14
+
15
+ Parameters
16
+ ----------
17
+ dataframe : pandas.DataFrame
18
+ The input DataFrame for which the summary needs to be generated.
19
+
20
+ Returns
21
+ -------
22
+ pandas.DataFrame
23
+ A DataFrame containing summary information for each column in 'df':
24
+ - Type: Data type of the column.
25
+ - Min: Minimum value in the column.
26
+ - Max: Maximum value in the column.
27
+ - Nan %: Percentage of NaN values in the column.
28
+ - # Unique Values: Total number of unique values in the column.
29
+ - Unique values: List of unique values in the column.
30
+
31
+ Example
32
+ -------
33
+ >>> data = {
34
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
35
+ 'time_in_hospital': [8, 3, 5],
36
+ 'n_lab_procedures': [72, 34, 45],
37
+ ...
38
+ }
39
+ >>> dataframe = pd.DataFrame(data)
40
+ >>> result = dataframe_summary(df)
41
+ >>> print(result)
42
+ Type Min Max Nan % # Unique Values Unique values
43
+ Variables
44
+ age object [40-50) [90-100) 0.0 3 ['[70-80)', '[50-60)', '[60-70)', '[40-50)', '[80-90)', ...
45
+ time_in_hospital int64 1 14 0.0 3 [8, 3, 5]
46
+ n_lab_procedures int64 1 113 0.0 3 [72, 34, 45]
47
+ ...
48
+
49
+ Note
50
+ ----
51
+ The function uses vectorized operations to improve performance and memory usage.
@@ -0,0 +1,53 @@
1
+ #config
2
+
3
+ [built-system]
4
+ requires = ["setuptools>=65.5.0","wheel"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "EDAeasy"
9
+ version = "1.0.0"
10
+ description = "Functions and tools for making Exploratory Data Analysis easy!"
11
+ readme = "README.md"
12
+ authors = [{ name = "Francisco Ocazionez-Cardozo", email = "focazionez@gmail.com" }]
13
+ license = { file = "LICENSE" }
14
+ classifiers = [
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3",
18
+ ]
19
+ keywords = ["Exploratory Data Analysis", "EDA", "Data"]
20
+ dependencies = [
21
+ 'numpy>=1.25.1',
22
+ 'pandas>=2.0.3',
23
+ 'python-dateutil>=2.8.2',
24
+ 'pytz>=2023.3',
25
+ 'six>=1.16.0',
26
+ 'tzdata>=2023.3',
27
+ ]
28
+ requires-python = ">=3.10"
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
32
+
33
+ [tool.bumpver]
34
+ current_version = "1.0.0"
35
+ version_pattern = "MAYOR.MINOR.PATCH"
36
+ commit_message = "bump version {old_version} -> {new_version}"
37
+ tag_message = "{new_version}"
38
+ tag_scope = "default"
39
+ commit = true
40
+ tag = true
41
+ push = true
42
+
43
+ [tool.bumpver.file_patterns]
44
+ "pyproject.toml" = [
45
+ 'current_version = "{version}"',
46
+ ]
47
+ "README.md" = [
48
+ "{version}",
49
+ "{pep440_version}",
50
+ ]
51
+ "src/EDAeasy/__init__.py" = [
52
+ "{version}"
53
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ # Version
2
+ __version__ = '1.0.0'
3
+
4
+ # Importing
5
+ from .functions import *
6
+
File without changes
@@ -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,86 @@
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
+ Provides-Extra: dev
34
+ License-File: LICENSE
35
+
36
+ # EDAeasy 😀
37
+ The package for quick exploratory data analysis
38
+
39
+
40
+ ## Instalation
41
+
42
+ `pip install EDAeasy`
43
+
44
+ ## Usage
45
+ The **dataframe_summary** function have relative simple summary of the columns of your dataframe
46
+ for quick look at tabular data
47
+
48
+ Generate a summary DataFrame of the input DataFrame 'dataframe'.
49
+
50
+ Parameters
51
+ ----------
52
+ dataframe : pandas.DataFrame
53
+ The input DataFrame for which the summary needs to be generated.
54
+
55
+ Returns
56
+ -------
57
+ pandas.DataFrame
58
+ A DataFrame containing summary information for each column in 'df':
59
+ - Type: Data type of the column.
60
+ - Min: Minimum value in the column.
61
+ - Max: Maximum value in the column.
62
+ - Nan %: Percentage of NaN values in the column.
63
+ - # Unique Values: Total number of unique values in the column.
64
+ - Unique values: List of unique values in the column.
65
+
66
+ Example
67
+ -------
68
+ >>> data = {
69
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
70
+ 'time_in_hospital': [8, 3, 5],
71
+ 'n_lab_procedures': [72, 34, 45],
72
+ ...
73
+ }
74
+ >>> dataframe = pd.DataFrame(data)
75
+ >>> result = dataframe_summary(df)
76
+ >>> print(result)
77
+ Type Min Max Nan % # Unique Values Unique values
78
+ Variables
79
+ age object [40-50) [90-100) 0.0 3 ['[70-80)', '[50-60)', '[60-70)', '[40-50)', '[80-90)', ...
80
+ time_in_hospital int64 1 14 0.0 3 [8, 3, 5]
81
+ n_lab_procedures int64 1 113 0.0 3 [72, 34, 45]
82
+ ...
83
+
84
+ Note
85
+ ----
86
+ The function uses vectorized operations to improve performance and memory usage.
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/EDAeasy/__init__.py
6
+ src/EDAeasy/config.toml
7
+ src/EDAeasy/functions.py
8
+ src/EDAeasy.egg-info/PKG-INFO
9
+ src/EDAeasy.egg-info/SOURCES.txt
10
+ src/EDAeasy.egg-info/dependency_links.txt
11
+ src/EDAeasy.egg-info/requires.txt
12
+ src/EDAeasy.egg-info/top_level.txt
13
+ test/test_functions.py
@@ -0,0 +1,13 @@
1
+ numpy>=1.25.1
2
+ pandas>=2.0.3
3
+ python-dateutil>=2.8.2
4
+ pytz>=2023.3
5
+ six>=1.16.0
6
+ tzdata>=2023.3
7
+
8
+ [dev]
9
+ black
10
+ bumpver
11
+ isort
12
+ pip-tools
13
+ pytest
@@ -0,0 +1 @@
1
+ EDAeasy
@@ -0,0 +1,77 @@
1
+ from EDAeasy import dataframe_summary
2
+ import pandas as pd
3
+
4
+ def test_dataframe_summary():
5
+ # Test Case 1: Basic test case with different data types
6
+ data = {
7
+ 'age': ['[40-50)', '[60-70)', '[70-80)'],
8
+ 'time_in_hospital': [8, 3, 5],
9
+ 'n_lab_procedures': [72, 34, 45],
10
+ 'weight': [65.5, 70.2, None],
11
+ 'is_diabetic': [True, False, True],
12
+ }
13
+ dataframe = pd.DataFrame(data)
14
+ result, (rows, columns) = dataframe_summary(dataframe)
15
+ assert rows == 3
16
+ assert columns == 5
17
+ assert result.loc['age', 'Type'] == 'object'
18
+ assert result.loc['time_in_hospital', 'Type'] == 'int64'
19
+ assert result.loc['n_lab_procedures', 'Type'] == 'int64'
20
+ assert result.loc['weight', 'Type'] == 'float64'
21
+ assert result.loc['is_diabetic', 'Type'] == 'bool'
22
+ assert result.loc['age', 'Min'] == '[40-50)'
23
+ assert result.loc['age', 'Max'] == '[70-80)'
24
+ assert result.loc['time_in_hospital', 'Min'] == 3
25
+ assert result.loc['time_in_hospital', 'Max'] == 8
26
+ assert result.loc['n_lab_procedures', 'Min'] == 34
27
+ assert result.loc['n_lab_procedures', 'Max'] == 72
28
+ assert result.loc['weight', 'Min'] == 65.5
29
+ assert result.loc['weight', 'Max'] == 70.2
30
+ assert result.loc['is_diabetic', 'Min'] == False
31
+ assert result.loc['is_diabetic', 'Max'] == True
32
+ assert result.loc['age', 'Nan %'] == 0.0
33
+ assert result.loc['time_in_hospital', 'Nan %'] == 0.0
34
+ assert result.loc['n_lab_procedures', 'Nan %'] == 0.0
35
+ assert result.loc['weight', 'Nan %'] == 33.33333333333333
36
+ assert result.loc['is_diabetic', 'Nan %'] == 0.0
37
+ assert result.loc['age', '# Unique Values'] == 3
38
+ assert result.loc['time_in_hospital', '# Unique Values'] == 3
39
+ assert result.loc['n_lab_procedures', '# Unique Values'] == 3
40
+ assert result.loc['weight', '# Unique Values'] == 3
41
+ assert result.loc['is_diabetic', '# Unique Values'] == 2
42
+ assert result.loc['age', 'Unique values'] == ['[40-50)', '[60-70)', '[70-80)']
43
+ assert result.loc['time_in_hospital', 'Unique values'] == ['3','5','8']
44
+ assert result.loc['n_lab_procedures', 'Unique values'] == ['34', '45', '72']
45
+ assert result.loc['weight', 'Unique values'] == ['65.5', '70.2', 'nan']
46
+ assert result.loc['is_diabetic', 'Unique values'] == ['False', 'True']
47
+
48
+ # Test Case 2: Test with an empty DataFrame
49
+ data = {
50
+ 'A': [],
51
+ 'B': [],
52
+ 'C': [],
53
+ }
54
+ dataframe = pd.DataFrame(data)
55
+ result, (rows, columns) = dataframe_summary(dataframe)
56
+ assert rows == 0
57
+ assert columns == 3
58
+ assert not result.empty
59
+
60
+ # Test Case 3: Test with all NaN values in a column
61
+ data = {
62
+ 'X': [None, None, None],
63
+ 'Y': [1, 2, 3],
64
+ }
65
+ dataframe = pd.DataFrame(data)
66
+ result, (rows, columns) = dataframe_summary(dataframe)
67
+ assert rows == 3
68
+ assert columns == 2
69
+ assert result.loc['X', 'Nan %'] == 100.0
70
+ assert result.loc['Y', 'Nan %'] == 0.0
71
+
72
+ # Add more test cases as needed
73
+
74
+ print("All test cases passed!")
75
+
76
+ # Run the test function
77
+ test_dataframe_summary()