databricks / Spark-The-Definitive-Guide

Spark: The Definitive Guide's Code Repository
http://shop.oreilly.com/product/0636920034957.do
Other
2.85k stars 2.76k forks source link

Updating Python code from python2 to python3 #58

Open tallamjr opened 4 years ago

tallamjr commented 4 years ago

This has been completed using the tool: 2to3

Note, "Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py" could not be updated due to parsing error:

Error:

RefactoringTool: There was 1 error:
RefactoringTool: Can't parse
Structured_APIs-Chapter_6_Working_with_Different_Types_of_Data.py:
ParseError: bad input: type=1, value='as', context=(' ', (334, 69))

Thus, the command run was:

$ 2to3 -w `ls *.py | grep -v *Chapter_6*.py`

See PR #58 for stdout of command for detailed changes

modified:   A_Gentle_Introduction_to_Spark-Chapter_3_A_Tour_of_Sparks_Toolset.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_24_Advanced_Analytics_and_Machine_Learning.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_25_Preprocessing_and_Feature_Engineering.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_26_Classification.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_27_Regression.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_28_Recommendation.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_29_Unsupervised_Learning.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_30_Graph_Analysis.py
modified:   Advanced_Analytics_and_Machine_Learning-Chapter_31_Deep_Learning.py
modified:   Ecosystem-Chapter_32_Language_Specifics.py
modified:   Low_Level_APIs-Chapter_12_RDD_Basics.py
modified:   Low_Level_APIs-Chapter_13_Advanced_RDDs.py
modified:   Production_Applications-Chapter_16_Spark_Applications.py
modified:   Structured_APIs-Chapter_5_Basic_Structured_Operations.py
modified:   Structured_APIs-Chapter_9_Data_Sources.py