by Diego Calvo | Nov 23, 2017 | Apache Spark, Neo4J Data Base, Python-example, R-example, Scala-example
Comparison of programming languages by Diego Calvo | Nov 23, 2017 | Apache Spark, Python-example
Function example in Spark Python Displays an example of a map function with Spark. def my_func(iterator): yield sum(iterator) list = range(1,10) parallel = sc.parallelize(list, 5) parallel.mapPartitions(my_func).collect() [1, 5, 9, 13,... by Diego Calvo | Nov 23, 2017 | Apache Spark, Python-example
Prerequisites Java 6 or higher Python Interpreter 2.6 or higher Installation Install is very simple just download the latest version of Spark and unzip wget http://apache.rediris.es/spark/spark-1.5-0/spark-1.5.0-bin-hadoop2.6.tgz tar -xf spark-1.5.0-bin-hadoop2.6.tgz... by Diego Calvo | Jul 20, 2017 | Python-example
Example of how to create a directory in Python: import os directory = “/Users/diego/test/” try: os.stat(directory) except: os.mkdir(directory) by Diego Calvo | Jul 17, 2017 | Python-example
Import External Python Packages Before importing them we must install them with the Command: pip install external_package Once installed to import them simply call the package name using the import command import external_package Import own Python Packages If... by Diego Calvo | Jul 17, 2017 | Python-example
Define the class to read arguments To use arguments passed by parameter in a Python script you can use the following library from argparse import ArgumentParser import sys # ArgumentParser with a description of the application parser =...