Skip to content

aminblm/spark-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Spark with Python

[Reminder] 🔔

Hosted by Amin M. Boulouma, contact and questions: amine.boulouma.com

Spark Installation

pip install pyspark
import random

from pyspark import SparkContext
sc = SparkContext()
def inside(p):     
  x, y = random.random(), random.random()
  return x*x + y*y < 1
num_samples = 1000000000

count = sc.parallelize(range(0, num_samples)).filter(inside).count()

pi = 4 * count / num_samples
print(pi)

sc.stop()

Ref: https://www.sicara.ai/blog/2017-05-02-get-started-pyspark-jupyter-notebook-3-minutes

About

Spark with python workshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published