Book Image

Learning PySpark [Video]

By : Tomasz Drabas
Book Image

Learning PySpark [Video]

By: Tomasz Drabas

Overview of this book

Apache Spark is an open-source distributed engine for querying and processing data. In this tutorial, we provide a brief overview of Spark and its stack. This tutorial presents effective, time-saving techniques on how to leverage the power of Python and put it to use in the Spark ecosystem. You will start by getting a firm understanding of the Apache Spark architecture and how to set up a Python environment for Spark. You'll learn about different techniques for collecting data, and distinguish between (and understand) techniques for processing data. Next, we provide an in-depth review of RDDs and contrast them with DataFrames. We provide examples of how to read data from files and from HDFS and how to specify schemas using reflection or programmatically (in the case of DataFrames). The concept of lazy execution is described and we outline various transformations and actions specific to RDDs and DataFrames. Finally, we show you how to use SQL to interact with DataFrames. By the end of this tutorial, you will have learned how to process data using Spark DataFrames and mastered data collection techniques by distributed data processing.
Table of Contents (5 chapters)
Chapter 2
Resilient Distributed Datasets
Content Locked
Section 9
Introducing Transformations – .sample(…)
In this video, we will learn how to sample data from RDDs. - Check how many records are in an RDD - Decide what proportion of records to return - Use the .sample(…) transformation to sample without replacement