cut

dataframe

Selects specific columns from a DataFrame

Syntax

cut(dataframe, columns)

Parameters

dataframe (dataframe)

The DataFrame to select columns from

columns (array)

Array of column names to select

Returns

dataframe

DataFrame containing only the specified columns

Examples

Select only name and age columns from the DataFrame
Input:
cut(["name", "age"])
Output:
DataFrame with only name and age columns
Select specific columns in the desired order
Input:
cut(["id", "email", "status"])
Output:
DataFrame with id, email, and status columns

The cut() function selects specific columns from a DataFrame, returning a new DataFrame containing only the specified columns. This is useful for focusing on relevant fields and reducing data size.

Usage

Use cut() to select only the columns you need for analysis, reorder columns, or prepare data for export. This function is especially useful before performing expensive operations on large datasets.

Related Functions