d20-data-preprocess 0.0.1__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.
@@ -0,0 +1 @@
1
+ src/d20_data_preprocess.egg-info
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DEBASHISH TIWARY
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,15 @@
1
+ Metadata-Version: 2.5
2
+ Name: d20-data-preprocess
3
+ Version: 0.0.1
4
+ Summary: A data preprocessing package.
5
+ Project-URL: Homepage, https://github.com/DebashishTiwary/Data_Preprocessor.git
6
+ Author-email: Debashish Tiwary <debasishtewary5@gmail.com>
7
+ License-File: LICENSE
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Data_Preprocessor
15
+ This project helps in automatic Preprocessing of data during creation of ML models. It is made on top of pandas, numpy, matplotlib.
@@ -0,0 +1,2 @@
1
+ # Data_Preprocessor
2
+ This project helps in automatic Preprocessing of data during creation of ML models. It is made on top of pandas, numpy, matplotlib.
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "d20-data-preprocess" # This is the name people will use for 'pip install'
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name="Debashish Tiwary", email="debasishtewary5@gmail.com" },
10
+ ]
11
+ description = "A data preprocessing package."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+
21
+ [tool.hatch.build.targets.wheel]
22
+ packages = ["src/d20_data_preprocess"]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/DebashishTiwary/Data_Preprocessor.git"
@@ -0,0 +1,136 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ import seaborn as sns
4
+ import matplotlib.pyplot as plt
5
+ from IPython.display import Image, display
6
+
7
+ #entering csv file
8
+ def EDA(df,target:any):
9
+ #check the extension of data
10
+ #print(df[target])
11
+ # print("Your Target Column:")
12
+ # print(df[target])
13
+ # print('-------------------------------------------------------------------------------------')
14
+ print("Data Size")
15
+ print(df.shape)
16
+ print("Information:")
17
+ print(df.info())
18
+ print('-------------------------------------------------------------------------------------')
19
+ print("Data Description:")
20
+ print(df.describe())
21
+ print('-------------------------------------------------------------------------------------')
22
+ print("Null Values:")
23
+ print(df.isnull().sum())
24
+ # print('-------------------------------------------------------------------------------------')
25
+ plt.figure(figsize=(8,6))
26
+ plt.title("Heatmap")
27
+ sns.heatmap(df.corr(numeric_only=True),annot=True,cmap='coolwarm')
28
+ print('-------------------------------------------------------------------------------------')
29
+
30
+ numerical_features = df.select_dtypes(include=[np.number]).columns.tolist()
31
+ categorical_features = df.select_dtypes(include=[np.object_]).columns.tolist()
32
+ print("Numerical Features:{}".format(numerical_features))
33
+ print("Categorical Features:{}".format(categorical_features))
34
+ print('-------------------------------------------------------------------------------------')
35
+ for feature in numerical_features:
36
+ plt.figure(figsize=(6, 4))
37
+ plt.title('BoxPlot')
38
+ sns.histplot(df[feature], kde=True,bins=10)
39
+ plt.title(f'Distribution of {feature}')
40
+ plt.xlabel(feature)
41
+ plt.ylabel('Frequency')
42
+ plt.show()
43
+
44
+ for feature in numerical_features:
45
+ plt.figure(figsize=(6,4))
46
+ plt.title('BoxPlot')
47
+ plt.boxplot(x=df[feature])
48
+ plt.xlabel(feature)
49
+ plt.show()
50
+ def showoutliers(df):
51
+ numerical_features = df.select_dtypes(include=[np.number]).columns.tolist()
52
+ for feature in numerical_features:
53
+ plt.figure(figsize=(6,4))
54
+ plt.title('BoxPlot')
55
+ plt.boxplot(x=df[feature])
56
+ plt.xlabel(feature)
57
+ plt.show()
58
+ def d20help(topic="all"):
59
+
60
+ catalog = {
61
+ "Data Cleaning & Structuring": {
62
+ "df.info()": "Prints a summary of the DataFrame, including data types and non-null counts.",
63
+ "df.describe()": "Generates summary statistics like mean, median, and min/max for numerical columns.",
64
+ "df.isna().sum()": "Counts the total number of missing (NaN) values in each column.",
65
+ "df.dropna()": "Removes rows or columns that contain missing or null values.",
66
+ "df.fillna()": "Replaces missing or null values with a specified value, mean, or median.",
67
+ "df.drop_duplicates()": "Removes duplicate rows to ensure every record is unique.",
68
+ "df.astype()": "Casts a column or Series to a specified data type (e.g., float to int).",
69
+ "df.rename()": "Alters column or row labels using a dictionary mapping.",
70
+ "df.drop()": "Removes specified rows or columns from the DataFrame."
71
+ },
72
+ "Data Transformation & Scaling": {
73
+ "pd.get_dummies()": "Converts categorical text columns into one-hot encoded numerical variables.",
74
+ "df.apply()": "Applies a custom function or lambda expression along a DataFrame axis.",
75
+ "df.map()": "Maps values of a Series using a dictionary or function for label encoding.",
76
+ "StandardScaler().fit_transform()": "Standardises features by removing the mean and scaling to unit variance.",
77
+ "MinMaxScaler().fit_transform()": "Rescales numerical features to a specified range, typically 0 to 1.",
78
+ "KBinsDiscretizer()": "Bins continuous numerical variables into discrete, categorical intervals."
79
+ },
80
+ "Reshaping & Combining Data": {
81
+ "pd.concat()": "Combines multiple DataFrames or Series along a particular axis (rows or columns).",
82
+ "pd.merge()": "Joins two DataFrames together based on a shared key or index (SQL-style join).",
83
+ "df.groupby()": "Groups data by specific criteria to allow for aggregate calculations.",
84
+ "df.pivot()": "Reshapes data from a long format to a wide format based on column values.",
85
+ "df.melt()": "Unpivots a DataFrame from a wide format to a long format."
86
+ },
87
+ "Advanced Feature Engineering": {
88
+ "train_test_split()": "Splits a dataset into random train and test subsets for model validation.",
89
+ "SimpleImputer()": "A scikit-learn transformer to handle missing data using mean, median, or mode.",
90
+ "OneHotEncoder()": "An ML-pipeline friendly scikit-learn transformer for encoding categorical features.",
91
+ "LabelEncoder()": "Encodes target labels with numerical values between 0 and n-1 classes.",
92
+ "PCA()": "Reduces dataset dimensionality by projecting data into a lower-dimensional space."
93
+ }
94
+ }
95
+
96
+ # 2. Logic to handle the "all" argument
97
+ if topic.lower() == "all":
98
+ print("=" * 60)
99
+ print("šŸ“Š COMPLETE DATA PREPROCESSING REFERENCE GUIDES šŸ“Š")
100
+ print("=" * 60)
101
+
102
+ for category, functions in catalog.items():
103
+ print(f"\nšŸ”¹ {category}")
104
+ print("-" * len(category))
105
+ for func, desc in functions.items():
106
+ # Formats the print to look clean in the console
107
+ print(f" • {func:<32} -> {desc}")
108
+ print("\n" + "=" * 60)
109
+
110
+ elif topic.lower() == 'clean':
111
+ li=catalog["Data Cleaning & Structuring"]
112
+ for func, desc in li.items():
113
+ print(f"-{func:<10} -> {desc}")
114
+ elif topic.lower() == 'transform':
115
+ li=catalog["Data Transformation & Scaling"]
116
+ for key,val in li.items():
117
+ print(f"-{key:<10} -> {val}")
118
+ elif topic.lower()=='reshape':
119
+ li=catalog["Reshaping & Combining Data"]
120
+ for key,val in li.items():
121
+ print(f"-{key:<10} -> {val}")
122
+ elif topic.lower()== 'advance':
123
+ li=catalog["Advanced Feature Engineering"]
124
+ for key,val in li.items():
125
+ print(f"-{key:<10} -> {val}")
126
+ else:
127
+ print(f"Topic '{topic}' not fully mapped yet. Pass 'all' to see all functions.")
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
@@ -0,0 +1,16 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ import seaborn as sns
4
+ import matplotlib.pyplot as plt
5
+ from IPython.display import Image, display
6
+
7
+ def onehotenc(df,value:str):
8
+ categorical_features = df.select_dtypes(include=[np.object_]).columns.tolist()
9
+ # if(value!=null):
10
+ df = pd.get_dummies(df,columns = [value],drop_first=True)
11
+ return df
12
+ # else:
13
+ # for feature in categorical_features:
14
+ # df = pd.get_dummies(df,columns = [feature],drop_first=True)
15
+ def levelenc(df,value:str):
16
+ df[value]=df[value].map({True:1,False:0})
File without changes
@@ -0,0 +1,27 @@
1
+ from IPython.display import display, HTML
2
+
3
+ def EDA(data):
4
+ # 1. Perform your Exploratory Data Analysis logic here
5
+ columns_count = len(data.columns)
6
+ row_count = len(data)
7
+
8
+ # 2. Design your document-style clickable HTML output
9
+ html_content = f"""
10
+ <div style="font-family: 'Arial', sans-serif; line-height: 1.6; max-width: 600px; padding: 15px; border: 1px solid #e0e0e0; border-radius: 5px; background-color: #f9f9f9;">
11
+ <h3 style="color: #2c3e50; margin-top: 0;">šŸ“Š Exploratory Data Analysis Report</h3>
12
+ <p style="margin: 5px 0;">Your dataset contains <strong>{columns_count} columns</strong> and <strong>{row_count} rows</strong>.</p>
13
+
14
+ <hr style="border: 0; border-top: 1px solid #ccc; margin: 15px 0;">
15
+
16
+ <!-- Clickable actions styled like a document index -->
17
+ <p style="margin: 8px 0;">
18
+ šŸ‘‰ <a href="#dataframe_preview" style="color: #1a73e8; text-decoration: none; font-weight: bold;">[View Dataframe Preview]</a>
19
+ </p>
20
+ <p style="margin: 8px 0;">
21
+ šŸ‘‰ <a href="https://pydata.org" target="_blank" style="color: #1a73e8; text-decoration: none; font-weight: bold;">[Open External Pandas Documentation]</a>
22
+ </p>
23
+ </div>
24
+ """
25
+ # learn here: https://share.google/aimode/7pIaZ8DkgQiwyGqt2
26
+ # 3. Use display(HTML()) instead of a standard return or print statement
27
+ display(HTML(html_content))