Skip to content

Commit

Permalink
Merge pull request #29 from dockter-84/improved-examples
Browse files Browse the repository at this point in the history
Update example.py
  • Loading branch information
parente committed Jul 27, 2016
2 parents a79f5be + 95f3c24 commit b7fd80b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions node_client_example/src/example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import pyspark
sc = pyspark.SparkContext()

# In some environments, "sc" is pre-defined.
if not 'sc' in globals():
sc = pyspark.SparkContext()
rdd = sc.parallelize(range(1000))
sample = rdd.takeSample(False, 5)
print(sample)
print(sample)

0 comments on commit b7fd80b

Please sign in to comment.