Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data-Mining-With-Python/Part 4/Section_3.1_3.2.ipynb - xrange deprecated in Python3 #4

Open
enzedonline opened this issue Jan 5, 2022 · 1 comment

Comments

@enzedonline
Copy link

For the flip coin demo, use range instead:

heads = (sc.parallelize(range(n))
.map(lambda _: random.random())
.filter(lambda r: r <= 0.5)
.count())

Python 3 was released in 2008! Why is the code with this course in 2.x?!

@enzedonline
Copy link
Author

You might also need the following environment variables to get it working:
PYSPARK_DRIVER_PYTHON=jupyter
PYSPARK_DRIVER_PYTHON_OPTS=notebook
PYSPARK_PYTHON=python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant