Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sklearn encoding pipelin

numeric_features = ["age", "fare"]
numeric_transformer = Pipeline(
    steps=[("imputer", SimpleImputer(strategy="median")), ("scaler", StandardScaler())]
)

categorical_features = ["embarked", "sex", "pclass"]
categorical_transformer = OneHotEncoder(handle_unknown="ignore")

preprocessor = ColumnTransformer(
    transformers=[
        ("num", numeric_transformer, numeric_features),
        ("cat", categorical_transformer, categorical_features),
    ]
)
Comment

PREVIOUS NEXT
Code Example
Python :: Dynamic use of templates in Jinja2 
Python :: python assert multiple conditions 
Python :: Flask - how do I combine Flask-WTF and Flask-SQLAlchemy to edit db models 
Python :: cuenta atras segundero python 
Python :: get type of enum variable python 
Python :: how to blend pixels in pygame 
Python :: tdlib python 
Python :: dataframe get missing and zero values 
Python :: containsDuplicate Set Solution 
Python :: merging results from model.predict() prediction with original pandas dataframe 
Python :: ring Using Lists during definition 
Python :: localizar la fila y columna de un dato pandas 
Python :: for loop the string from reverse order and skipping last element in string python 
Python :: django bring specific values first 
Python :: python adx indicator 
Python :: cannot set `other` if drop=True 
Python :: import sys execute cmd 
Python :: how to add list toa key in ict 
Python :: rĂșllandi veltandi standandi sitjandi 
Python :: python min date from dictionary 
Python :: python print string in red color 
Python :: arrays with name instead of index python 
Python :: pattern program in python A aB bCc DdEe 
Python :: python check if not none or empty 
Python :: convert to lowercase command python 
Python :: apa itu duck typing python 
Python :: python execute echo to file 
Python :: remove uppercase letters python 
Python :: implementation of binary search tree in python 
Python :: python scrapy browser headers to dictionary 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =