Excerpt |
---|
Retains a set of rows in your dataset, which are specified by the conditional in the row expression. All other rows are removed from the dataset. |
The
keep
transform is the opposite of the
delete
transform. See
Delete Transform.
D code |
---|
keep row:(customerStatus == 'active') |
Output: For each row in the dataset, if the value of the customerStatus
column is active
, then the row is retained. Otherwise, the row is deleted from the dataset.
D code |
---|
keep row:(expression) |
Token | Required? | Data Type | Description |
---|
keep | Y | transform | Name of the transform |
row | Y | string | Expression identifying the row or rows to keep. If expression evaluates to true for a row, the row is retained. |
Include Page |
---|
| row Parameter |
---|
| row Parameter |
---|
|
For the keep
transform, if the expression for the row
parameter evaluates to true
for a row, it is kept in the dataset. Otherwise, it is removed.
Example:
D code |
---|
keep row: (lastOrder >= 10000 && status == 'Active') |
Output: Retains all rows in the dataset where the lastOrder
value is greater than or equal to 10,000 and the customer status is Active
.
Required? | Data Type |
---|
Yes | Expression that evaluates to true or false |
Include Page |
---|
| EXAMPLE - Delete and Keep Transforms |
---|
| EXAMPLE - Delete and Keep Transforms |
---|
|
D s also |
---|
label | wrangle_transform_keep |
---|
|