The .select(...) transformation

The .select(...) transformation allows us to extract column or columns from a DataFrame. It works the same way as SELECT found in SQL.

Look at the following code snippet:

# select Model and ScreenSize from the DataFrame

sample_data_schema.select('Model', 'ScreenSize').show()

It produces the following output:

In SQL syntax, this would look like the following:

SELECT Model
, ScreenSize
FROM sample_data_schema;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset