This recipe shows how to concatenate, merge/join, and perform complex operations over Pandas DataFrames as well as Spark DataFrames.
To step through this recipe, you will need a running Spark cluster either in pseudo distributed mode or in one of the distributed modes, that is, standalone, YARN, or Mesos. Also, have Python and IPython installed on the Linux machine, that is, Ubuntu 14.04.
Invoke
ipython console -profile=pyspark
:In [1]: from pyspark import SparkConf, SparkContext, SQLContext In [2]: import pandas as pd In [3]: sqlcontext = SQLContext(sc) In [4]: pdf1 = pd.DataFrame({'A':['A0','A1','A2','A3'], 'B': ['B0','B1','B2','B3'], 'C':['C0','C1','C2','C3'],'D': ['D0','D1','D2','D3']},index=[0,1,2,3]) In [5]: pdf2 = pd.DataFrame({'A':['A4','A5','A6','A7'], 'B': ['B4','B5','B6','B7'], 'C':['C4','C5','C6','C7'],'D': ...