Skip to content

Instantly share code, notes, and snippets.

@xiaowei1234
Last active April 24, 2019 15:53
Show Gist options
  • Save xiaowei1234/a6b218522920f5c161324cde2fabdce6 to your computer and use it in GitHub Desktop.
Save xiaowei1234/a6b218522920f5c161324cde2fabdce6 to your computer and use it in GitHub Desktop.
Status Code Transformation
from sklearn.pipeline import make_pipeline
wrap2 = DataFrameMapper([
('Status 1', LookupTransformer({203:1}, 0))
, ('Status 2', LookupTransformer({203:1}, 0))
, ('Status 3', LookupTransformer({203:1}, 0))
])
union = ExpressionTransformer("X[0]+X[1]+X[2]")
pl = make_pipeline(wrap2, union)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment