December 2016
Beginner to intermediate
392 pages
8h 13m
English
This recipe shows how to perform complex operations such as computing difference on a column in 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.
ipython console -profile=pyspark: In [1]: from pyspark import SparkConf, SparkContext, SQLContext
In [2]: import pandas as pd
In [3]: sqlcontext = SQLContext(sc)diff on a column in Pandas:In [4]: df = sqlCtx.createDataFrame([(1, 4), (1, 5), (2, 6), (2, 6), (3, 0)], ["A", "B"]) ...
Read now
Unlock full access