concept dataframe in category spark

appears as: dataframe, dataframes, A dataframe, Dataframes, Dataframe, The dataframe
Spark in Action, Second Edition

This is an excerpt from Manning's book Spark in Action, Second Edition.

After the data has been loaded, at t 5, you can process the records. Your operation is fairly simple: you will add to the dataframe a new column, called name . The full name (in the column name ) is a concatenation of the last name (from the column lname ), a comma, a space, and the first name (from the column fname ). So, Jean-Georges (first name) and Perrin (last name) becomes Perrin, Jean-Georges . Listing 2.6 describes the process, and figure 2.8 illustrates it.

In this chapter, you will learn about using the dataframe. You’ll learn that the dataframe is so important in a Spark application because it contains typed data through a schema and offers a powerful API.

3.1 The essential role of the dataframe in Spark

In this section, you will learn what a dataframe is and how it is organized. You will also learn about immutability.

A dataframe is both a data structure and an API, as illustrated in figure 3.1. Spark’s dataframe API is used within Spark SQL, Spark Streaming, MLlib (for machine learning), and GraphX to manipulate graph-based data structures within Spark. Using this unified API drastically simplifies access to those technologies. You will not have to learn an API for each sublibrary.

Figure 3.1 By having to learn only one API to do Spark SQL, streaming, machine and deep learning, and graph-based analytics, the developer is happier!

It is probably odd to describe the dataframe as majestic, but this qualifier suits it perfectly. Just as majestic artwork attracts curiosity, a majestic oak dominates the forest, and majestic walls protect a castle, the dataframe is majestic in the world of Spark.

*** Dataframe transformed
+---------------+-----------+-----+---------------+------+---------------+
| name| city|state| type|county| id|
+---------------+-----------+-----+---------------+------+---------------+
| WABA| RALEIGH| NC| Restaurant| Wake|NC_Wake_0409...|
|WALMART DELI...| CARY| NC| Food Stand| Wake|NC_Wake_0409...|
|CAROLINA SUS...| RALEIGH| NC| Restaurant| Wake|NC_Wake_0409...|
|THE CORNER V...| RALEIGH| NC|Mobile Food ...| Wake|NC_Wake_0409...|
| SUBWAY #3726|WAKE FOREST| NC| Restaurant| Wake|NC_Wake_0409...|
+---------------+-----------+-----+---------------+------+---------------+
 only showing top 5 rows