From the course: Complete Guide to Databricks for Data Engineering
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Use the select function in PySpark - Databricks Tutorial
From the course: Complete Guide to Databricks for Data Engineering
Use the select function in PySpark
- [Instructor] Now it's time to select some specific column because so far, we were displaying all the columns every time. If, like an SQL, if you want to select some of a specific column from your data frame, you can do that. How? Let us see. For example, we have a data frame. Out of that, we want to select only few columns. So I can use the select function and I can paste the name of all those columns that I want to view. For example: age, gender, and, maybe let's say, customer type. And then again, this will also give me another data frame. I can store it into a different variable, that is data frame one, and now I can say "display data frame one". If you see the output, you will find that this is showing me only three columns, not all the columns. In fact, sometimes I want to create a derived column. Derived column means you want to use your existing column, do some manipulation in that, and get some value and you want to see that. How you can do that? Let us see. For example, I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Use filter and where transformations in PySpark8m 30s
-
(Locked)
Add or remove columns in PySpark8m 56s
-
(Locked)
Use the select function in PySpark6m 16s
-
(Locked)
Use UNION and DISTINCT in PySpark5m 31s
-
(Locked)
Handle nulls in PySpark8m 39s
-
(Locked)
Use sortBy and orderBy in PySpark9m 38s
-
(Locked)
Use groupBy and aggregation in PySpark8m 27s
-
(Locked)
Manipulate strings in PySpark14m 21s
-
(Locked)
Handle date manipulation in PySpark9m 37s
-
(Locked)
Handle timestamp manipulation in PySpark4m 29s
-
-
-
-
-
-
-
-
-
-
-
-