Transform Modes¶
add.transform(mode, df, ...) supports 12 modes for in-place DataFrame transformations. Each mode is accessed by passing a string starting with @ as the first argument.
| Mode | Purpose | Key Parameters | Page |
|---|---|---|---|
@calc | Calculate new columns | expression, name, strategy | → |
@filter | Filter rows | where, columns | → |
@sort | Sort rows | by, strategy | → |
@aggregate | Group and summarize | by, strategy | → |
@deduce | Impute missing values | infer, method, against | → |
@extract | Extract patterns / datetime | columns, expression | → |
@split | Split text columns | columns, by | → |
@onehot | One-hot encoding | columns | → |
@label | Label encoding | columns | → |
@harmonize | Unit conversions | columns, strategy | → |
@round | Round numeric values | columns, strategy | — |
@transpose | Transpose DataFrame | — | — |
Quick Examples¶
import additory as add
# Calculate
result = add.transform('@calc', df, expression='price * qty', name='total')
# Filter
result = add.transform('@filter', df, where='age >= 18')
# Sort
result = add.transform('@sort', df, by='score', strategy='desc')
# Aggregate
result = add.transform('@aggregate', df, by='dept', strategy={'salary': 'average'})
# Impute
result = add.transform('@deduce', df, infer='age', method='mean')
# Encode
result = add.transform('@onehot', df, columns='color')