Skip to content

Commit 5ac8b19

Browse files
committed
Better example
1 parent 349b9a2 commit 5ac8b19

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,14 @@ mapper.add_Y('Survived')
2525
X_train, Y_train = mapper.fit_transform(df_train)
2626
X_test, _ = mapper.transform(df_test)
2727
```
28+
29+
We see from the above example that we can register both x variables and y variables from a given dataframe. Moreover, we can apply the transformation stored in the mapping layer to the test set (ignoring, of course, the result. If we had the answers at hand these challenges would be a lot easier).
30+
31+
Also see, that we can specify a simple list instead of a Pipeline object, and interject our own functions into the list. The line
32+
33+
```python
34+
mapper.add_X('Sex', [lambda x: x == 'male', LabelBinarizer()])
35+
```
36+
37+
first passes that column of our dataframe through our lambda function, mapping it into a column of True/Falses, and then we split that through sklearn`s LabelBinarizer, to get 0 and 1's.
38+

0 commit comments

Comments
 (0)