select() method
Selects the specified columns in a dataframe for inclusion in a new dataframe.
Syntax
dataframe_name.select(columns = ["column", "...n"])
Parameters
Name | Description |
---|---|
columns = ["column", "...n"] |
The column or columns to select. The columns are positioned in the output dataframe in the order that you list them. |
Returns
HCL dataframe.
Examples
Select the specified columns for inclusion in a new dataframe
You want a reduced set of information for the items in an inventory: basic identifying information, location, and quantity on hand. You select five relevant columns from the inventory dataframe for inclusion in the inventory_brief dataframe. You do not select columns that contain information you do not currently need.
inventory_brief = inventory.select(columns = ["ProdNo", "ProdDesc", "ProdCls", "Location", "QtyOH"])