panddu 2.4__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.

Potentially problematic release.


This version of panddu might be problematic. Click here for more details.

panddu-2.4/PKG-INFO ADDED
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.4
2
+ Name: panddu
3
+ Version: 2.4
4
+ Requires-Python: >=3.7
@@ -0,0 +1,31 @@
1
+ # panddu - type pd.<name> to show a snippet; pd.all for the menu.
2
+ class _Code(str):
3
+ __slots__ = ()
4
+ def __repr__(self):
5
+ return str.__str__(self)
6
+
7
+
8
+ bayestheorem = _Code('import pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn.naive_bayes import MultinomialNB\nfrom sklearn.metrics import accuracy_score, confusion_matrix, classification_report\nimport seaborn as sns\nimport matplotlib.pyplot as plt\ndf = pd.read_csv("spam.csv", encoding=\'latin-1\')[[\'v1\', \'v2\']]\ndf.columns = [\'Label\', \'Message\']\ndf[\'Label\'] = df[\'Label\'].map({\'ham\': 0, \'spam\': 1})\n \nprint(df.head())\ndf.info()\n\nx = df[\'Message\']\ny = df[\'Label\']\nx_train,x_test,y_train,y_test = train_test_split(x,y,test_size = 0.2,random_state = 42)\nvectorizer = CountVectorizer()\nx_train_vec = vectorizer.fit_transform(x_train)\nx_test_vec = vectorizer.transform(x_test)\nnb_model = MultinomialNB()\nnb_model.fit(x_train_vec,y_train)\ny_pred = nb_model.predict(x_test_vec)\naccuracy = accuracy_score(y_test,y_pred)\nprint(f"Accuracy: {accuracy*100:.2f}%")\ncm= confusion_matrix(y_test,y_pred)\nsns.heatmap(cm,annot=True,fmt=\'d\',cmap=\'Blues\',\n xticklabels=[\'Ham\',\'Spam\'],\n yticklabels=[\'Ham\',\'Spam\'])\nplt.title("confusion Matrix")\nplt.xlabel("Predicted")\nplt.ylabel("Actual")\nplt.show()\n\nprint(classification_report(y_test,y_pred))\n\n\nnew_message = ["congratulation! you are have won a free lottery of 2,00,000 rupees",\n "You creditcard will expire in 5 days click the link to issue a new card"]\nnew_vec = vectorizer.transform(new_message)\nprediction = nb_model.predict(new_vec)\n\nfor msg, pred in zip(new_message, prediction):\n label = "Spam" if pred == 1 else "Ham"\n print(f"Message: \'{msg}\' => Prediction: {label}")')
9
+ bfs = _Code("graph2 = {\n 'A':['B','C'],\n 'B':['D','E'],\n 'C':['F','G'],\n 'D':[],\n 'E':['H'],\n 'F':[],\n 'G':[],\n 'H':[]\n}\nGoal = 'H'\nStart = 'A'\nfrom collections import deque\n\nprint('BFS')\n\nQ = deque()\nV = set()\n\nQ.append(Start)\nV.add(Start)\n\nrev = {'A':None}\n\nwhile Q:\n node = Q.popleft()\n print(node, end = ' ')\n if node == Goal:\n\n break\n for neighbour in graph2[node]:\n if neighbour not in V:\n V.add(neighbour)\n Q.append(neighbour)\n rev[neighbour] = node\n\n\nprint()\nL = [Goal]\nval = Goal\nwhile val:\n if rev[val] == None:\n break\n else:\n L.append(rev[val])\n val = rev[val]\n\nprint(L[::-1])")
10
+ bfstraversal = _Code("graph = {\n 'A': ['B', 'C'],\n 'B': ['D', 'E'],\n 'C': ['F','G'],\n 'D': [],\n 'E': [],\n 'F': [],\n 'G': []\n}\n\nfrom collections import deque\nqueue = deque()\nvisited = set()\nqueue.append('A')\nvisited.add('A')\n\nprint('BFS Traversal')\n\nwhile queue:\n node = queue.popleft()\n print(node, end = ' ')\n\n for neighbour in graph[node]:\n if neighbour not in visited:\n visited.add(neighbour)\n queue.append(neighbour)")
11
+ dfs = _Code("graph2 = {\n 'A':['B','C'],\n 'B':['D','E'],\n 'C':['F','G'],\n 'D':[],\n 'E':['H'],\n 'F':[],\n 'G':[],\n 'H':[]\n}\nGoal = 'H'\nStart = 'A'\nfrom collections import deque\n\nvisited = set()\nrev = {Start : None}\ndef dfs(node):\n if node not in visited:\n visited.add(node)\n print(node, end = ' ')\n if node == Goal:\n return\n for neighbour in graph2[node]:\n rev[neighbour] = node\n dfs(neighbour)\n\ndfs(Start)\n\nprint()\nL = [Goal]\nval = Goal\nwhile val:\n if rev[val] == None:\n break\n else:\n L.append(rev[val])\n val = rev[val]\n\nprint(L[::-1])")
12
+ dfstraversal = _Code("graph = {\n 'A': ['B', 'C'],\n 'B': ['D', 'E'],\n 'C': ['F','G'],\n 'D': [],\n 'E': [],\n 'F': [],\n 'G': []\n}\n\nfrom collections import deque\nqueue = deque()\nvisited = set()\nqueue.append('A')\nvisited.add('A')\n\nprint('DFS Traversal')\n\nstack = []\nvisited = set()\n\nstack.append('A')\nvisited.add('A')\n\nwhile stack:\n node = stack.pop()\n print(node, end= ' ')\n for neighbour in graph[node]:\n if neighbour not in visited:\n visited.add(neighbour)\n stack.append(neighbour)")
13
+ robotcleaning1 = _Code('room = {"A" : "Dirty" , "B" : "Dirty"}\nrobot = "A"\nwhile True:\n if robot == "A":\n if room["A"] == "Dirty":\n print("Cleaning A")\n room["A"] = "Clean"\n else:\n print("A is Clean")\n robot = "B"\n else:\n if room["B"] == "Dirty":\n print("Cleaning B")\n room["B"] = "Clean"\n else:\n print("B is Clean")\n print("Goal Achieved")\n break')
14
+ robotcleaning2 = _Code('room = {"A" : "Dirty" , "B" : "Dirty"}\nrobot = {"A" : 0, "B" : 0}\npos = "A"\nwhile True:\n if (robot["A"] == 1) & (robot["B"] == 1):\n print("Goal Achieved")\n print("All Rooms are Cleaned")\n break\n\n if pos == "A":\n if room["A"] == "Dirty":\n print("Cleaning A")\n room["A"] = "Clean"\n else:\n print("A is Clean")\n robot["A"] = 1\n print("Moving to Room B taking right")\n pos = "B"\n elif pos == "B":\n if room["B"] == "Dirty":\n print("Cleaning B")\n room["B"] = "Clean"\n else:\n print("B is Clean")\n robot["B"] = 1\n print("Moving to Room A taking left")\n pos = "A"')
15
+ robotcleaning4 = _Code('room = {"A" : "Dirty" , "B" : "Dirty", "C": "Clean","D" : "Dirty"}\nrobot = {"A" : 0, "B" : 0, "C" : 0, "D" : 0}\npos = "A"\nwhile True:\n if (robot["A"] == 1) & (robot["B"] == 1) & (robot["C"] == 1) & (robot["D"] == 1):\n print("Goal Achieved")\n print("All Rooms are Cleaned")\n break\n\n if pos == "A":\n if room["A"] == "Dirty":\n print("Cleaning A")\n room["A"] = "Clean"\n else:\n print("A is Clean")\n robot["A"] = 1\n print("Moving to Room B taking right")\n pos = "B"\n elif pos == "B":\n if room["B"] == "Dirty":\n print("Cleaning B")\n room["B"] = "Clean"\n else:\n print("B is Clean")\n robot["B"] = 1\n print("Moving to Room C going down")\n pos = "C"\n elif pos == "C":\n if room["C"] == "Dirty":\n print("Cleaning C")\n room["C"] = "Clean"\n else:\n print("C is Clean")\n robot["C"] = 1\n print("Moving to Room D taking left")\n pos = "D"\n\n elif pos == "D":\n if room["D"] == "Dirty":\n print("Cleaning D")\n room["D"] = "Clean"\n else:\n print("D is Clean")\n robot["D"] = 1\n print("Moving to Room A going up")\n pos = "A"\n')
16
+ vendingmachinewithchange = _Code('Products = {\n "Coke" : {"Price" : 50, "Qty" : 15},\n "Lays" : {"Price" : 20, "Qty" : 10},\n "Sprite" : {"Price" : 30, "Qty" : 12},\n "Nachos" : {"Price" : 120, "Qty" : 5},\n "Diet Coke" : {"Price" : 40, "Qty" : 20},\n "Pringles" : {"Price" : 100, "Qty" : 10},\n }\n\nwhile True:\n print( )\n print("Wending Machine")\n print(\'Available Products\')\n\n for key, value in Products.items():\n print(key)\n print("Price : \u20b9", value["Price"])\n print("Quantity : ", value["Qty"])\n print()\n\n Input_P = input("Enter the product name : ")\n Input_P = Input_P.capitalize()\n if (Input_P not in Products):\n print("Incorrect Product Selected")\n continue\n\n qty = int(input("Enter Quantity : "))\n\n if (qty > Products[Input_P]["Qty"] or qty == 0 ):\n print("Qty Not Available")\n continue\n\n Amount = Products.get(Input_P)["Price"]*qty\n print("The amount to be payed : \u20b9", Amount)\n\n Input_A = int(input("Pay the bill: \u20b9"))\n\n if Input_A == Amount:\n print("Dispensing ", Input_P)\n Products[Input_P]["Qty"] = Products[Input_P]["Qty"] - qty\n print("Order Completed")\n\n elif Input_A > Amount:\n print("Dispensing ", Input_P)\n Products[Input_P]["Qty"] = Products[Input_P]["Qty"] - qty\n Change = Input_A - Amount\n print("Returning Change : \u20b9",Change)\n print("Order Completed")\n\n elif Input_A < Amount:\n print("Insufficient Money")\n print("Amount Remaining : ",Amount - Input_A)\n print("Order Rejected")\n\n else:\n print("Incorrect Product Selected")\n print("Order Rejected")')
17
+ vendingmachinewithoutchange = _Code('while True:\n Products = {\n "Coke" : 50,\n "Lays" : 20,\n "Sprite" : 30,\n "Nachos" : 120,\n "Diet Coke" : 40,\n "Pringles" : 100,\n }\n print( )\n print("Wending Machine")\n print(\'Available Products\')\n\n for key, value in Products.items():\n print(key,": \u20b9" ,value)\n\n Input_P = input("Enter the product name : ")\n Input_P = Input_P.capitalize()\n\n if (Input_P not in Products):\n print("Incorrect Product Selected")\n continue\n\n Amount = Products.get(Input_P)\n print("The amount to be payed : \u20b9", Amount)\n\n Input_A = int(input("Pay the bill: \u20b9"))\n\n if Input_A == Amount:\n print("Dispensing ", Input_P)\n print("Order Completed")\n\n elif Input_A > Amount:\n print("Dispensing ", Input_P)\n Change = Input_A - Amount\n print("Returning Change : \u20b9",Change)\n print("Order Completed")\n\n elif Input_A < Amount:\n print("Insufficient Money")\n print("Amount Remaining : ",Amount - Input_A)\n print("Order Rejected")\n\n else:\n print("Incorrect Product Selected")\n print("Order Rejected")')
18
+
19
+ bayes = bayestheorem
20
+ robot1 = robotcleaning1
21
+ robot2 = robotcleaning2
22
+ robot4 = robotcleaning4
23
+ vend = vendingmachinewithoutchange
24
+ vendc = vendingmachinewithchange
25
+
26
+ all = _Code('panddu\n bayestheorem bayes\n bfs \n bfstraversal \n dfs \n dfstraversal \n robotcleaning1 robot1\n robotcleaning2 robot2\n robotcleaning4 robot4\n vendingmachinewithchange vendc\n vendingmachinewithoutchange vend\n\ntype pd.<name> to show the code - pd.all for this menu')
27
+
28
+ __all__ = ['bayestheorem', 'bfs', 'bfstraversal', 'dfs', 'dfstraversal', 'robotcleaning1', 'robotcleaning2', 'robotcleaning4', 'vendingmachinewithchange', 'vendingmachinewithoutchange', 'bayes', 'robot1', 'robot2', 'robot4', 'vend', 'vendc'] + ['all']
29
+
30
+ def __dir__():
31
+ return sorted(__all__)
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.4
2
+ Name: panddu
3
+ Version: 2.4
4
+ Requires-Python: >=3.7
@@ -0,0 +1,6 @@
1
+ pyproject.toml
2
+ panddu/__init__.py
3
+ panddu.egg-info/PKG-INFO
4
+ panddu.egg-info/SOURCES.txt
5
+ panddu.egg-info/dependency_links.txt
6
+ panddu.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ panddu
@@ -0,0 +1,11 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "panddu"
7
+ version = "2.4"
8
+ requires-python = ">=3.7"
9
+
10
+ [tool.setuptools]
11
+ packages = ["panddu"]
panddu-2.4/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+