<jupyter_start><jupyter_text>A simple example of Spark RDD **sc = Spark Contenx**<jupyter_code>sc<jupyter_output><empty_output><jupyter_text>**Loading a Data Set (e.g. CSV file) to get started with RDD**<jupyter_code>filePath="users.csv"
## For Linux "file:///Users/tirthalp/something/gs-spark-python/notebooks/01/users.csv"
## For Windows "C:\\Users\\tirthalp\\something\\gs-spark-python\\notebooks\\01\\users.csv"
usersRDD = sc.textFile(filePath)
usersRDD<jupyter_output><empty_output><jupyter_text>**Do transformations on RDD**<jupyter_code>usersRDDInUpperCase = usersRDD.map(lambda line: line.upper())<jupyter_output><empty_output><jupyter_text>**Perform action on RDD**<jupyter_code>usersRDD.take(5)
usersRDDInUpperCase.take(5)
usersRDDInUpperCase.count()
usersRDDInUpperCase.first()
usersRDDInUpperCase.collect()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1474056603773585, 'fraction_numerical': 0.007075471698113208, 'mean_word_length': 8.758620689655173, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '244908', 'license': 'MIT', 'n_tokens_mistral': 336, 'n_tokens_neox': 327, 'n_words': 42, 'path': 'gs-spark/gs-spark-python/notebooks/01/SparkRdd-HelloWorld.ipynb', 'repo_name': 'tirthalpatel/Learning-BigData', 'size': '848'}