Skip to content

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

@enzedonline

Description

@enzedonline

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?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions