DjPractLelo 0.2.2__tar.gz → 0.2.3__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.
Files changed (47) hide show
  1. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/DjPractLelo/resource_loader.py +10 -11
  2. djpractlelo-0.2.3/DjPractLelo/resources/ClassificationModel.py +28 -0
  3. djpractlelo-0.2.3/DjPractLelo/resources/LogisticRegression.py +46 -0
  4. djpractlelo-0.2.3/DjPractLelo/resources/MONGODB.py +46 -0
  5. djpractlelo-0.2.3/DjPractLelo/resources/MultipleRegression.py +48 -0
  6. djpractlelo-0.2.3/DjPractLelo/resources/SVM.py +20 -0
  7. djpractlelo-0.2.3/DjPractLelo/resources/Titanic-Dataset.csv +892 -0
  8. djpractlelo-0.2.3/DjPractLelo/resources/cluster(a).py +29 -0
  9. djpractlelo-0.2.3/DjPractLelo/resources/desicion_tree.py +41 -0
  10. djpractlelo-0.2.3/DjPractLelo/resources/mapreduced(weather).py +34 -0
  11. djpractlelo-0.2.3/DjPractLelo/resources/mapreduced(wordcount).py +26 -0
  12. djpractlelo-0.2.3/DjPractLelo/resources/students.csv +9 -0
  13. djpractlelo-0.2.3/DjPractLelo/resources/titanic_analysis (1).py +74 -0
  14. djpractlelo-0.2.3/DjPractLelo/resources/weather(3).csv +17 -0
  15. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/DjPractLelo.egg-info/PKG-INFO +1 -1
  16. djpractlelo-0.2.3/DjPractLelo.egg-info/SOURCES.txt +25 -0
  17. djpractlelo-0.2.3/LICENCE +0 -0
  18. djpractlelo-0.2.3/MANIFEST.in +2 -0
  19. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/PKG-INFO +1 -1
  20. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/pyproject.toml +3 -3
  21. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/setup.py +1 -1
  22. djpractlelo-0.2.2/DjPractLelo/resources/GIS10.docx +0 -0
  23. djpractlelo-0.2.2/DjPractLelo/resources/GIS2.docx +0 -0
  24. djpractlelo-0.2.2/DjPractLelo/resources/GIS3.docx +0 -0
  25. djpractlelo-0.2.2/DjPractLelo/resources/GIS4.docx +0 -0
  26. djpractlelo-0.2.2/DjPractLelo/resources/GIS5.docx +0 -0
  27. djpractlelo-0.2.2/DjPractLelo/resources/GIS6.docx +0 -0
  28. djpractlelo-0.2.2/DjPractLelo/resources/GIS7.docx +0 -0
  29. djpractlelo-0.2.2/DjPractLelo/resources/GIS8.docx +0 -0
  30. djpractlelo-0.2.2/DjPractLelo/resources/GIS9.docx +0 -0
  31. djpractlelo-0.2.2/DjPractLelo/resources/prac 4.txt +0 -94
  32. djpractlelo-0.2.2/DjPractLelo/resources/prac10.txt +0 -183
  33. djpractlelo-0.2.2/DjPractLelo/resources/prac2.txt +0 -84
  34. djpractlelo-0.2.2/DjPractLelo/resources/prac3.txt +0 -60
  35. djpractlelo-0.2.2/DjPractLelo/resources/prac5.txt +0 -50
  36. djpractlelo-0.2.2/DjPractLelo/resources/prac6 wms.txt +0 -38
  37. djpractlelo-0.2.2/DjPractLelo/resources/prac7.txt +0 -63
  38. djpractlelo-0.2.2/DjPractLelo/resources/prac8.txt +0 -143
  39. djpractlelo-0.2.2/DjPractLelo/resources/prac9.txt +0 -173
  40. djpractlelo-0.2.2/DjPractLelo.egg-info/SOURCES.txt +0 -29
  41. djpractlelo-0.2.2/MANIFEST.in +0 -2
  42. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/DjPractLelo/__init__.py +0 -0
  43. /djpractlelo-0.2.2/LICENCE → /djpractlelo-0.2.3/DjPractLelo/resources/titanic_analysis.py +0 -0
  44. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/DjPractLelo.egg-info/dependency_links.txt +0 -0
  45. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/DjPractLelo.egg-info/top_level.txt +0 -0
  46. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/README.md +0 -0
  47. {djpractlelo-0.2.2 → djpractlelo-0.2.3}/setup.cfg +0 -0
@@ -1,35 +1,34 @@
1
1
  from importlib.resources import files
2
2
  from pathlib import Path
3
- import docx # from python-docx
4
3
 
5
4
  # Base resources directory
6
5
  BASE_RESOURCES = files("DjPractLelo") / "resources"
7
6
 
8
- ALLOWED_EXTENSIONS = (".txt", ".docx")
7
+ ALLOWED_EXTENSIONS = (".py", ".csv")
9
8
 
10
9
 
11
10
  def get_file(category: str, filename: str) -> Path:
12
11
  """
13
- Get a specific TXT or DOCX file from a category.
12
+ Get a specific PY or CSV file from a category.
14
13
  category: 'data_science' or 'soft_computing'
15
14
  """
16
15
  if not filename.endswith(ALLOWED_EXTENSIONS):
17
- raise ValueError("Only .txt and .docx files are allowed")
16
+ raise ValueError("Only .py and .csv files are allowed")
18
17
 
19
18
  return BASE_RESOURCES / category / filename
20
19
 
21
20
 
22
21
  def list_files(category: str) -> list[Path]:
23
22
  """
24
- List all TXT and DOCX files in a category.
23
+ List all PY and CSV files in a category.
25
24
  """
26
25
  directory = BASE_RESOURCES / category
27
26
  return [p for p in directory.iterdir() if p.suffix in ALLOWED_EXTENSIONS]
28
27
 
29
28
 
30
- def load_txt(filename: str, category: str = "data_science") -> str:
29
+ def load_csv(filename: str, category: str = "data_science") -> str:
31
30
  """
32
- Read a TXT file and return its content.
31
+ Read a CSV file and return its content as text.
33
32
  """
34
33
  path = get_file(category, filename)
35
34
 
@@ -37,11 +36,11 @@ def load_txt(filename: str, category: str = "data_science") -> str:
37
36
  return f.read()
38
37
 
39
38
 
40
- def load_docx(filename: str, category: str = "data_science") -> str:
39
+ def load_py(filename: str, category: str = "soft_computing") -> str:
41
40
  """
42
- Read a DOCX file and return its text.
41
+ Read a PY file and return its code as text.
43
42
  """
44
43
  path = get_file(category, filename)
45
44
 
46
- document = docx.Document(path)
47
- return "\n".join([p.text for p in document.paragraphs])
45
+ with open(path, "r", encoding="utf-8") as f:
46
+ return f.read()
@@ -0,0 +1,28 @@
1
+ from sklearn.tree import DecisionTreeClassifier
2
+
3
+ # Student Names
4
+ students = ["Sam", "Nidhi", "Tejas", "Ricky", "Sai",
5
+ "Kamlii", "vinay", "Dharmesh", "Mitu", "Roma"]
6
+
7
+ # Features: [Marks, Attendance]
8
+ X = [[35,60],[40,65],[75,85],[80,90],[55,70],
9
+ [30,50],[90,95],[45,60],[70,80],[25,40]]
10
+
11
+ # Target
12
+ y = ["Fail","Fail","Pass","Pass","Pass",
13
+ "Fail","Pass","Fail","Pass","Fail"]
14
+
15
+ # Train Classifier
16
+ dt = DecisionTreeClassifier()
17
+ dt.fit(X, y)
18
+
19
+ # Predict result for a new student
20
+ student_name = "Sam"
21
+ new_student = [[75, 80]] # Marks, Attendance
22
+
23
+ result = dt.predict(new_student)
24
+
25
+ print("Student Name :", student_name)
26
+ print("Marks :", new_student[0][0])
27
+ print("Attendance :", new_student[0][1], "%")
28
+ print("Prediction :", result[0])
@@ -0,0 +1,46 @@
1
+ # Import libraries
2
+ import pandas as pd
3
+ from sklearn.linear_model import LogisticRegression
4
+
5
+ # Create dataset
6
+ data = {
7
+ "Name": ["Sam", "Nidhi", "Tejas", "Ricky", "Sai"],
8
+ "GRE": [750, 600, 700, 500, 650],
9
+ "GPA": [3.8, 3.2, 3.6, 2.8, 3.4],
10
+ "Rank": [1, 2, 1, 4, 3],
11
+ "Admit": [1, 1, 1, 0, 0]
12
+ }
13
+
14
+ df = pd.DataFrame(data)
15
+
16
+ # Features and target
17
+ X = df[["GRE", "GPA", "Rank"]]
18
+ y = df["Admit"]
19
+
20
+ # Train model
21
+ model = LogisticRegression()
22
+ model.fit(X, y)
23
+
24
+ # Input new student details
25
+ name = input("Enter Student Name: ")
26
+ gre = int(input("Enter GRE Score: "))
27
+ gpa = float(input("Enter GPA: "))
28
+ rank = int(input("Enter College Rank (1-4): "))
29
+
30
+ # Create DataFrame for prediction
31
+ new_student = pd.DataFrame({
32
+ "GRE": [gre],
33
+ "GPA": [gpa],
34
+ "Rank": [rank]
35
+ })
36
+
37
+ # Predict admission
38
+ result = model.predict(new_student)
39
+
40
+ # Display result
41
+ print("\nStudent Name:", name)
42
+
43
+ if result[0] == 1:
44
+ print("Admission Status: Admitted")
45
+ else:
46
+ print("Admission Status: Not Admitted")
@@ -0,0 +1,46 @@
1
+ from pymongo import MongoClient
2
+ import pandas as pd
3
+
4
+ client = MongoClient("mongodb://localhost:27017/")
5
+ db = client["BigDataDB"]
6
+ collection = db["StudentData"]
7
+
8
+ df = pd.read_csv("students.csv")
9
+
10
+ print("\nOriginal CSV Data:\n")
11
+ print(df)
12
+
13
+ data = df.to_dict(orient="records")
14
+
15
+ collection.delete_many({})
16
+
17
+ collection.insert_many(data)
18
+
19
+ print("\nCSV Data Inserted into MongoDB Successfully\n")
20
+
21
+ records = list(collection.find())
22
+
23
+ mongo_df = pd.DataFrame(records)
24
+
25
+ mongo_df = mongo_df.drop(columns=["_id"])
26
+
27
+ print("Data Read From MongoDB:\n")
28
+ print(mongo_df)
29
+ mongo_df["Marks"] = mongo_df["Marks"] + 5
30
+ filtered = mongo_df[mongo_df["Marks"] > 85]
31
+ sorted_data = filtered.sort_values(by="Marks", ascending=False)
32
+ print("\nManipulated Data:\n")
33
+ print(sorted_data)
34
+
35
+ for index, row in sorted_data.iterrows():
36
+ collection.update_one(
37
+ {"Name": row["Name"]},
38
+ {"$set": {"Marks": int(row["Marks"])}}
39
+ )
40
+
41
+ print("\nMongoDB Updated Successfully\n")
42
+
43
+ print("Final Data From MongoDB:\n")
44
+
45
+ for record in collection.find({}, {"_id": 0}):
46
+ print(record)
@@ -0,0 +1,48 @@
1
+ from sklearn.linear_model import LinearRegression
2
+
3
+ # Student Names
4
+ students = ["Sam", "Nidhi", "Tejas", "Ricky", "sai",
5
+ "Kamlesh", "Vinay", "Dharmesh", "Mitu", "Roma"]
6
+
7
+ # Features: [Study Hours, Attendance]
8
+ X = [
9
+ [3,60],
10
+ [3,65],
11
+ [6,85],
12
+ [7,90],
13
+ [5,70],
14
+ [1,50],
15
+ [8,95],
16
+ [3,60],
17
+ [6,80],
18
+ [1,40]
19
+ ]
20
+
21
+ # Final Marks
22
+ y = [80,90,45,80,55,30,20,45,30,25]
23
+
24
+ # Train Model
25
+ model = LinearRegression()
26
+ model.fit(X, y)
27
+
28
+ # Display existing students and results
29
+ print("Student Results")
30
+ print("-" * 40)
31
+
32
+ for i in range(len(students)):
33
+ result = "Pass" if y[i] >= 40 else "Fail"
34
+ print(students[i], "- Marks:", y[i], "-", result)
35
+
36
+ # Predict for a new student
37
+ new_student_name = "Nidhi"
38
+ new_student = [[4,75]]
39
+
40
+ predicted_marks = model.predict(new_student)[0]
41
+
42
+ result = "Pass" if predicted_marks >= 40 else "Fail"
43
+
44
+ print("\nNew Student Prediction")
45
+ print("-" * 40)
46
+ print("Name:", new_student_name)
47
+ print("Predicted Marks:", round(predicted_marks, 2))
48
+ print("Result:", result)
@@ -0,0 +1,20 @@
1
+ from sklearn.svm import SVC
2
+
3
+
4
+ x = [[80,20],[65,25],[40,60],[65,45],[85,95]]
5
+ y = ["Pass","Fail","Pass","Fail","Pass"]
6
+
7
+
8
+ model = SVC()
9
+ model.fit(x, y)
10
+
11
+
12
+ Name = input("Enter your Name: ")
13
+ Marks = int(input("Enter your Marks: "))
14
+ Attendance = int(input("Enter your Attendance: "))
15
+
16
+
17
+ result = model.predict([[Marks, Attendance]])
18
+
19
+ print("Name:", Name)
20
+ print("Result:", result[0])