Skip to content

Commit

Permalink
Reverting unnecessary change in previous commit
Browse files Browse the repository at this point in the history
This reverts the changes made in 17655ce to 3 specific files as the
changed introduced by 2to3 script are not required for the code to run
in Python 3.

This has been tested locally in a Jupyter notebook running Python 3.7.6

REF:
    - 17655ce

	modified:   code/Ecosystem-Chapter_32_Language_Specifics.py
	modified:   code/Low_Level_APIs-Chapter_12_RDD_Basics.py
	modified:   code/Low_Level_APIs-Chapter_13_Advanced_RDDs.py
  • Loading branch information
tallamjr committed May 19, 2020
1 parent 17655ce commit 5217dbe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion code/Ecosystem-Chapter_32_Language_Specifics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pandas as pd
df = pd.DataFrame({"first":list(range(200)), "second":list(range(50,250))})
df = pd.DataFrame({"first":range(200), "second":range(50,250)})


# COMMAND ----------
Expand Down
2 changes: 1 addition & 1 deletion code/Low_Level_APIs-Chapter_12_RDD_Basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def startsWithS(individual):

# COMMAND ----------

spark.sparkContext.parallelize(list(range(1, 21))).reduce(lambda x, y: x + y) # 210
spark.sparkContext.parallelize(range(1, 21)).reduce(lambda x, y: x + y) # 210


# COMMAND ----------
Expand Down
11 changes: 5 additions & 6 deletions code/Low_Level_APIs-Chapter_13_Advanced_RDDs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@

# COMMAND ----------

list(keyword.keys()).collect()
list(keyword.values()).collect()
keyword.keys().collect()
keyword.values().collect()


# COMMAND ----------

import random
from functools import reduce
distinctChars = words.flatMap(lambda word: list(word.lower())).distinct()\
.collect()
sampleMap = dict([(c, random.random()) for c in distinctChars])
sampleMap = dict(map(lambda c: (c, random.random()), distinctChars))
words.map(lambda word: (word.lower()[0], word))\
.sampleByKey(True, sampleMap, 6).collect()

Expand All @@ -48,7 +47,7 @@ def maxFunc(left, right):
return max(left, right)
def addFunc(left, right):
return left + right
nums = sc.parallelize(list(range(1,31)), 5)
nums = sc.parallelize(range(1,31), 5)


# COMMAND ----------
Expand Down Expand Up @@ -122,7 +121,7 @@ def mergeCombinerFunc(vals1, vals2):

# COMMAND ----------

numRange = sc.parallelize(list(range(10)), 2)
numRange = sc.parallelize(range(10), 2)
words.zip(numRange).collect()


Expand Down

0 comments on commit 5217dbe

Please sign in to comment.