Code description
In PySpark, we can use select
function to select a subset or all columns from a DataFrame.
Syntax
DataFrame.select(*cols)
This function returns a new DataFrame
object based on the projection expression list.
This code snippet prints out the following output:
+---+----------------+-------+---+ | id|customer_profile| name|age| +---+----------------+-------+---+ | 1| {Kontext, 3}|Kontext| 3| | 2| {Tech, 10}| Tech| 10| +---+----------------+-------+---+