pande 0.1.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.
pande-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: pande
3
+ Version: 0.1.0
4
+ Summary: A simple package
5
+ Author-email: xploiter <you@example.com>
6
+ License: MIT
7
+ Keywords: python,example
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+
14
+ # My Awesome Package
15
+
16
+ Simple Python package.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install pande
pande-0.1.0/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # My Awesome Package
2
+
3
+ Simple Python package.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install pande
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pande"
7
+ version = "0.1.0"
8
+ description = "A simple package"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "xploiter", email = "you@example.com"}
13
+ ]
14
+ requires-python = ">=3.9"
15
+
16
+ dependencies = []
17
+
18
+ keywords = ["python", "example"]
19
+
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ ]
pande-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .pande import add
@@ -0,0 +1,204 @@
1
+ def add(a, b):
2
+ return a + b
3
+
4
+
5
+
6
+ '''
7
+ //pract2
8
+ with open("input.txt", "w") as f:
9
+ f.write("""Hello Spark
10
+ Hello Hadoop
11
+ Spark is fast
12
+ Hadoop is powerful
13
+ """)
14
+
15
+ from pyspark import SparkContext
16
+
17
+ # Create or get existing SparkContext
18
+ sc = SparkContext.getOrCreate()
19
+
20
+ # Read input file
21
+ text_file = sc.textFile("/content/input.txt")
22
+
23
+ # Split into words
24
+ words = text_file.flatMap(lambda line: line.split())
25
+
26
+ # Create (word,1) pairs
27
+ word_pairs = words.map(lambda word: (word, 1))
28
+
29
+ # Count words
30
+ word_counts = word_pairs.reduceByKey(lambda a, b: a + b)
31
+
32
+ # Display results
33
+ for word, count in word_counts.collect():
34
+ print(f"{word}: {count}")
35
+
36
+ # Stop Spark (optional)
37
+ # sc.stop()
38
+
39
+ # Tri-gram Model
40
+
41
+ text = "I love machine learning because machine learning is fun"
42
+ words = text.lower().split()
43
+
44
+ trigrams = {}
45
+
46
+ for i in range(len(words) - 2):
47
+ trigrams[(words[i], words[i+1])] = words[i+2]
48
+
49
+ print("Tri-gram Model:")
50
+ for key, value in trigrams.items():
51
+ print(key, "->", value)
52
+
53
+
54
+ # Install PySpark (Run once)
55
+ # !pip install pyspark
56
+
57
+ from pyspark.sql import SparkSession
58
+ import matplotlib.pyplot as plt
59
+
60
+ # Create Spark Session
61
+ spark = SparkSession.builder.appName("GraphData").getOrCreate()
62
+
63
+ # Create Data
64
+ data = [("A", 10), ("B", 20), ("C", 15), ("D", 25)]
65
+ df = spark.createDataFrame(data, ["Name", "Value"])
66
+
67
+ # Display Data
68
+ df.show()
69
+
70
+ # Convert to Pandas for plotting
71
+ pdf = df.toPandas()
72
+
73
+ # Create Bar Graph
74
+ plt.bar(pdf["Name"], pdf["Value"])
75
+ plt.title("Spark Graphical Data")
76
+ plt.xlabel("Name")
77
+ plt.ylabel("Value")
78
+ plt.show()
79
+
80
+ # Stop Spark
81
+ spark.stop()
82
+
83
+
84
+
85
+ //pract5 haddop, spark
86
+ from pyspark.sql import SparkSession
87
+
88
+ # Create Spark Session
89
+ spark = SparkSession.builder.appName("ErrorRecovery").getOrCreate()
90
+
91
+ try:
92
+ # Read input file
93
+ df = spark.read.text("input.txt")
94
+
95
+ # Display data
96
+ df.show()
97
+
98
+ except Exception as e:
99
+ print("Error:", e)
100
+ print("Recovery: Please check if 'input.txt' exists.")
101
+
102
+ finally:
103
+ # Stop Spark Session
104
+ spark.stop()
105
+ print("Spark session closed.")
106
+
107
+
108
+
109
+
110
+ //pract6
111
+ import os
112
+
113
+ os.makedirs("/content/stream", exist_ok=True)
114
+
115
+ with open("/content/stream/input1.txt", "w") as f:
116
+ f.write("Hello Spark\n")
117
+ f.write("Spark Streaming Example\n")
118
+ f.write("Spark Streaming Example\n")
119
+ f.write("Sparoook Streaming Example\n")
120
+ f.write("Spark Streaming Example\n")
121
+ f.write("Spark Streaming Example\n")
122
+ f.write("Spark Streaming Example\n")
123
+ f.write("Spark Streaming Example\n")
124
+
125
+ from google.colab import drive
126
+ drive.mount('/content/drive')
127
+
128
+ import os
129
+ from pyspark.sql import SparkSession
130
+
131
+ # Create folder
132
+ os.makedirs("/content/stream", exist_ok=True)
133
+
134
+ # Create sample file
135
+ with open("/content/stream/input1.txt", "w") as f:
136
+ f.write("Hello Spark\n")
137
+ f.write("Streaming Example\n")
138
+
139
+ # Spark Session
140
+ spark = SparkSession.builder \
141
+ .master("local[*]") \
142
+ .appName("FileStreaming") \
143
+ .getOrCreate()
144
+
145
+ # Read streaming files
146
+ df = spark.readStream.text("/content/stream")
147
+
148
+ # Write to console
149
+ query = df.writeStream \
150
+ .format("console") \
151
+ .outputMode("append") \
152
+ .start()
153
+
154
+ # Run for 20 seconds only
155
+ query.awaitTermination(5)
156
+
157
+ # Stop query
158
+ query.stop()
159
+
160
+ print("Streaming Completed")
161
+
162
+ import time
163
+
164
+ print("Streaming Started...\n")
165
+
166
+ with open("input.txt", "r") as file:
167
+ for line in file:
168
+ print("Received:", line.strip())
169
+ time.sleep(1) # Delay of 1 second
170
+
171
+ print("\nStreaming Completed.")
172
+
173
+
174
+ # Create sample source files
175
+ with open("source1.txt", "w") as f:
176
+ f.write("Log Entry 1 from Source 1\n")
177
+ f.write("Log Entry 2 from Source 1\n")
178
+
179
+ with open("source2.txt", "w") as f:
180
+ f.write("Log Entry 1 from Source 2\n")
181
+ f.write("Log Entry 2 from Source 2\n")
182
+
183
+ # Centralized data store
184
+ output_file = "centralized_store.txt"
185
+
186
+ # Read from multiple sources and write to centralized store
187
+ sources = ["source1.txt", "source2.txt"]
188
+
189
+ with open(output_file, "w") as outfile:
190
+ for source in sources:
191
+ with open(source, "r") as infile:
192
+ outfile.write(f"--- Data from {source} ---\n")
193
+ outfile.write(infile.read())
194
+ outfile.write("\n")
195
+
196
+ print("Data transported successfully!")
197
+
198
+ # Display the centralized data
199
+ with open(output_file, "r") as f:
200
+ print("\nCentralized Data Store:\n")
201
+ print(f.read())
202
+
203
+
204
+ '''
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: pande
3
+ Version: 0.1.0
4
+ Summary: A simple package
5
+ Author-email: xploiter <you@example.com>
6
+ License: MIT
7
+ Keywords: python,example
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+
14
+ # My Awesome Package
15
+
16
+ Simple Python package.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install pande
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/pande/_init_.py
4
+ src/pande/pande.py
5
+ src/pande.egg-info/PKG-INFO
6
+ src/pande.egg-info/SOURCES.txt
7
+ src/pande.egg-info/dependency_links.txt
8
+ src/pande.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ pande