## FittedRecipe.transform()


Apply each trained step, in order, to new data.


Usage

``` python
FittedRecipe.transform(data)
```


Every step applies the statistics stored at fit time. Steps that only act on training samples (such as row filters) are skipped, as are steps whose selection matched no columns. The result is a data frame of the same type as [data](data.md#mlfeatures.data).


## Parameters


`data: DataFrame`  
The data frame to transform. Its columns and dtypes must match the training data; a mismatch raises an error naming the difference.


## Raises


`StepError`  
If a step fails while transforming; the error names the step and the columns it was working on.


## Examples

[transform()](Step.transform.md#mlfeatures.Step.transform) applies the trained recipe to new data, returning a data frame with the columns the recipe learned at fit time:


``` python
recipe = (
    Recipe(data=credit, target="Status")
    .add(StepNormalize(s.numeric_features()))
    .add(StepDummy(s.nominal_features()))
)
fitted = recipe.fit(credit)
```


``` python
result = fitted.transform(credit.head(5))
result
```


shape: (5, 23)

| Status | Seniority | Time | Age | Expenses | Income | Assets | Debt | Amount | Price | Home_other | Home_owner | Home_parents | Home_priv | Home_rent | Marital_married | Marital_separated | Marital_single | Marital_widow | Records_yes | Job_freelance | Job_others | Job_partime |
|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|
| str | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 | i8 |
| "good" | 0.104473 | 0.911743 | -0.630317 | 0.887353 | -0.157881 | -0.541693 | -0.313105 | -0.501373 | -0.997081 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| "good" | 1.086074 | 0.911743 | 1.909999 | -0.404875 | -0.133084 | -0.541693 | -0.313105 | -0.065705 | 0.344189 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| "bad" | 0.227173 | -0.738506 | 0.821292 | 1.766069 | 0.722397 | -0.220497 | -0.313105 | 2.112637 | 2.536142 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
| "good" | -0.999828 | 0.911743 | -1.17467 | 0.370462 | 0.499228 | -0.274029 | -0.313105 | -0.283539 | -0.205864 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| "good" | -0.999828 | -0.738506 | -0.993219 | -0.508253 | -0.430643 | -0.541693 | -0.313105 | -1.56876 | -0.891365 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
