Transform
Create new variables, recode, reshape, aggregate.
Create / Modify variables
Compute Variable
What it is. Creates a new variable from an expression (e.g., income_log = log(income + 1)).
Options / Parameters
Use np.where(cond, a, b) for conditionals.
Recode
What it is. Maps existing values to new ones (e.g., 1,2 → 'low'; 3,4 → 'high').
When to use. To collapse categories or convert strings to numeric codes.
Options / Parameters
Standardize (Z-scores)
What it is. Transform a variable to mean 0 / SD 1, or to min-max [0,1].
When to use. Before PCA, clustering, or whenever variables have very different scales.
Options / Parameters
Categorize / Bin
What it is. Convert numeric into categories (quartiles, percentiles, or custom breaks).
Options / Parameters
Create Dummy Variables
What it is. Expand a categorical variable into multiple 0/1 indicators.
When to use. For regression where predictors must be numeric.
Options / Parameters
Lag / Lead
What it is. Shift values k periods forward (lead) or backward (lag).
When to use. Time series — build lagged predictors for ARIMA, VAR, etc.
Rank
What it is. Convert values to ranks (1,2,3...).
Options / Parameters
Split Column
What it is. Split a text column into multiple columns (e.g., 'John_Smith' → 'John' | 'Smith').
Options / Parameters
Concatenate Columns
What it is. Join 2+ columns into one (e.g., 'First' + 'Last' → 'FullName').
Reshape / Aggregate
Reshape Long
What it is. Convert wide → long. e.g., columns year1, year2, year3 become one 'year' column + one 'value' column.
When to use. For longitudinal time series, repeated-measures analyses.
Pivot Longer (Complex)
What it is. Advanced wide → long using a regex to split column names into multiple output columns.
Options / Parameters
Reshape Wide
What it is. Long → wide. Spread one column across several.
Aggregate
What it is. Group rows and compute summaries (mean/sum/count/...) per group.
When to use. Summaries by country, month, category, etc.
Merge Datasets
What it is. Combine two datasets by a common key (SQL-like join).
Options / Parameters
Crosstab Counts
What it is. Produce a counts matrix from two categorical variables.