Code2Intelligences 0.1.5__tar.gz → 0.2.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.
@@ -0,0 +1,4 @@
1
+ from .utils import get_code, get_data
2
+ from .fdsa import fdsa
3
+
4
+ __all__ = ['get_code', 'get_data', 'fdsa']
@@ -0,0 +1,241 @@
1
+ """
2
+ ✅ Class fdsa - Contains all programs from fds.py as text
3
+ Each method returns the program code as a string
4
+ """
5
+
6
+
7
+ class fdsa:
8
+ """Class containing all data science and ML programs as text"""
9
+
10
+ @staticmethod
11
+ def program_1():
12
+ """EX NO: 1 – NumPy Arrays"""
13
+ return """# ========== PROGRAM 1: NumPy Arrays ==========
14
+
15
+ import numpy as np
16
+
17
+ arr = np.array([[1,2,3],[4,2,5]])
18
+
19
+ print("Type:", type(arr))
20
+ print("Dimensions:", arr.ndim)
21
+ print("Shape:", arr.shape)
22
+ print("Size:", arr.size)
23
+ print("Datatype:", arr.dtype)"""
24
+
25
+ @staticmethod
26
+ def program_2():
27
+ """EX NO: 2 – Array Slicing"""
28
+ return """# ========== PROGRAM 2: Array Slicing ==========
29
+
30
+ import numpy as np
31
+
32
+ a = np.array([[1,2,3],[3,4,5],[4,5,6]])
33
+
34
+ print(a)
35
+ print("Second column:", a[:,1])
36
+ print("Second row:", a[1,:])
37
+ print("Column 1 onwards:\\n", a[:,1:])"""
38
+
39
+ @staticmethod
40
+ def program_3():
41
+ """EX NO: 3 – Pandas DataFrame"""
42
+ return """# ========== PROGRAM 3: Pandas DataFrame ==========
43
+
44
+ import numpy as np
45
+ import pandas as pd
46
+
47
+ data = np.array([['','Col1','Col2'],
48
+ ['Row1',1,2],
49
+ ['Row2',3,4]])
50
+
51
+ df = pd.DataFrame(data=data[1:,1:], index=data[1:,0], columns=data[0,1:])
52
+ print(df)
53
+
54
+ arr = np.array([[1,2,3],[4,5,6]])
55
+ print(pd.DataFrame(arr))
56
+
57
+ d = {1:['1','3'],2:['1','2'],3:['2','4']}
58
+ print(pd.DataFrame(d))"""
59
+
60
+ @staticmethod
61
+ def program_4():
62
+ """EX NO: 4 – Iris Dataset (CSV)"""
63
+ return """# ========== PROGRAM 4: Iris Dataset (CSV) ==========
64
+
65
+ import pandas as pd
66
+
67
+ df = pd.read_csv("Iris.csv")
68
+
69
+ print(df.head())
70
+ print("Shape:", df.shape)
71
+
72
+ print(df.info())
73
+ print(df.describe())
74
+
75
+ print("Missing values:\\n", df.isnull().sum())
76
+
77
+ # Remove duplicates
78
+ data = df.drop_duplicates(subset="Species")
79
+ print(data)
80
+
81
+ print(df["Species"].value_counts())"""
82
+
83
+ @staticmethod
84
+ def program_5():
85
+ """EX NO: 5 – Univariate Analysis"""
86
+ return """# ========== PROGRAM 5: Univariate Analysis ==========
87
+
88
+ import pandas as pd
89
+ import numpy as np
90
+
91
+ df = pd.read_csv("diabetes.csv")
92
+
93
+ def analysis(df):
94
+ for col in df.columns:
95
+ print(f"\\n--- {col} ---")
96
+ print("Mean:", df[col].mean())
97
+ print("Median:", df[col].median())
98
+ print("Mode:", df[col].mode()[0])
99
+ print("Variance:", df[col].var())
100
+ print("Std Dev:", df[col].std())
101
+ print("Skewness:", df[col].skew())
102
+
103
+ analysis(df)"""
104
+
105
+ @staticmethod
106
+ def program_6():
107
+ """EX NO: 6 – Logistic Regression"""
108
+ return """# ========== PROGRAM 6: Logistic Regression ==========
109
+
110
+ import pandas as pd
111
+ import numpy as np
112
+ from sklearn.model_selection import train_test_split
113
+ from sklearn.linear_model import LogisticRegression
114
+ from sklearn.metrics import accuracy_score
115
+
116
+ df = pd.read_csv("diabetes.csv")
117
+
118
+ df.replace(0, np.nan, inplace=True)
119
+ df.fillna(df.mean(numeric_only=True), inplace=True)
120
+
121
+ X = df.drop("Outcome", axis=1)
122
+ y = df["Outcome"]
123
+
124
+ X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
125
+
126
+ model = LogisticRegression(max_iter=1000)
127
+ model.fit(X_train, y_train)
128
+
129
+ y_pred = model.predict(X_test)
130
+
131
+ print("Accuracy:", accuracy_score(y_test, y_pred))"""
132
+
133
+ @staticmethod
134
+ def program_7():
135
+ """EX NO: 7 – Histogram + Normal Curve"""
136
+ return """# ========== PROGRAM 7: Histogram + Normal Curve ==========
137
+
138
+ import pandas as pd
139
+ import numpy as np
140
+ import seaborn as sns
141
+ import matplotlib.pyplot as plt
142
+ from scipy.stats import norm
143
+
144
+ df = pd.read_csv("Iris.csv")
145
+
146
+ for col in df.columns[:-1]:
147
+ sns.histplot(df[col], kde=True, stat="density")
148
+
149
+ mean, std = norm.fit(df[col])
150
+ xmin, xmax = plt.xlim()
151
+ x = np.linspace(xmin, xmax, 100)
152
+ p = norm.pdf(x, mean, std)
153
+
154
+ plt.plot(x, p, 'k', linewidth=2)
155
+ plt.title(col)
156
+ plt.show()"""
157
+
158
+ @staticmethod
159
+ def program_8():
160
+ """EX NO: 8 – Density + Contour"""
161
+ return """# ========== PROGRAM 8: Density + Contour ==========
162
+
163
+ import pandas as pd
164
+ import seaborn as sns
165
+ import matplotlib.pyplot as plt
166
+
167
+ df = pd.read_csv("Iris.csv")
168
+
169
+ # Density
170
+ for col in df.columns[:-1]:
171
+ sns.kdeplot(data=df, x=col, hue="Species", fill=True)
172
+ plt.show()
173
+
174
+ # Contour
175
+ sns.pairplot(df, hue="Species", kind="kde")
176
+ plt.show()"""
177
+
178
+ @staticmethod
179
+ def program_9():
180
+ """EX NO: 9 – Correlation + Scatter"""
181
+ return """# ========== PROGRAM 9: Correlation + Scatter ==========
182
+
183
+ import pandas as pd
184
+ import seaborn as sns
185
+ import matplotlib.pyplot as plt
186
+
187
+ df = pd.read_csv("diabetes.csv")
188
+
189
+ corr = df.corr(numeric_only=True)
190
+ sns.heatmap(corr, annot=True)
191
+ plt.show()
192
+
193
+ plt.scatter(df["Glucose"], df["Insulin"])
194
+ plt.show()
195
+
196
+ plt.scatter(df["BMI"], df["Age"])
197
+ plt.show()"""
198
+
199
+ @staticmethod
200
+ def program_10():
201
+ """EX NO: 10 – Histogram + 3D Plot"""
202
+ return """# ========== PROGRAM 10: Histogram + 3D Plot ==========
203
+
204
+ import pandas as pd
205
+ import matplotlib.pyplot as plt
206
+ from mpl_toolkits.mplot3d import Axes3D
207
+
208
+ df = pd.read_csv("diabetes.csv")
209
+
210
+ # Histogram
211
+ df.hist()
212
+ plt.show()
213
+
214
+ # 3D plot
215
+ fig = plt.figure()
216
+ ax = fig.add_subplot(111, projection='3d')
217
+
218
+ ax.scatter(df["Glucose"], df["BMI"], df["Age"])
219
+
220
+ ax.set_xlabel("Glucose")
221
+ ax.set_ylabel("BMI")
222
+ ax.set_zlabel("Age")
223
+
224
+ plt.show()"""
225
+
226
+
227
+ # Usage examples:
228
+ if __name__ == "__main__":
229
+ # Get program 1 as text
230
+ print("Program 1:")
231
+ print(fdsa.program_1())
232
+ print("\n" + "="*50 + "\n")
233
+
234
+ # Get program 2 as text
235
+ print("Program 2:")
236
+ print(fdsa.program_2())
237
+ print("\n" + "="*50 + "\n")
238
+
239
+ # Get program 3 as text
240
+ print("Program 3:")
241
+ print(fdsa.program_3())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Code2Intelligences
3
- Version: 0.1.5
3
+ Version: 0.2.0
4
4
  Summary: My reusable python module
5
5
  Author: Unknown
6
6
  Requires-Python: >=3.7
@@ -1,6 +1,7 @@
1
1
  pyproject.toml
2
2
  setup.py
3
3
  Code2Intelligences/__init__.py
4
+ Code2Intelligences/fdsa.py
4
5
  Code2Intelligences/utils.py
5
6
  Code2Intelligences.egg-info/PKG-INFO
6
7
  Code2Intelligences.egg-info/SOURCES.txt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Code2Intelligences
3
- Version: 0.1.5
3
+ Version: 0.2.0
4
4
  Summary: My reusable python module
5
5
  Author: Unknown
6
6
  Requires-Python: >=3.7
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Code2Intelligences"
3
- version = "0.1.5"
3
+ version = "0.2.0"
4
4
  description = "My reusable python module"
5
5
  authors = [{name = "Unknown"}]
6
6
  readme = "README.md"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="Code2Intelligences",
5
- version="0.1",
5
+ version="0.2.0",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  )
@@ -1 +0,0 @@
1
- from .utils import get_code,get_data