Created
April 29, 2017 05:03
-
-
Save bobquest33/7940d3ec4ea85e7087f0db9695c9400f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Basic Non Empty line count example | |
#Read a text file and create RDD lines | |
lines = sc.textFile("wordtxt.txt") | |
#Use tranformation function filter to create notEmptyLines from lines | |
notEmptyLines = lines.filter(lambda line:len(line)>0) | |
#Execute action count to save the count of non empty lines to count | |
#And print it | |
count = notEmptyLines.count() | |
print(count) | |
#Sample output | |
#500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment