# import necessary libraries
import pandas as pd

# read data frame and view rows
df = pd.read_csv('http://bit.ly/kaggletrain', nrows=10)

# select some or all features of the dataset
cols = ['Fare', 'Embarked', 'Sex', 'Age']
X = df[cols]

# import necessary libraries
from sklearn.preprocessing import OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.compose import ColumnTransformer

# initialize transformer objects
ohe_transformer = OneHotEncoder()
imputer_transformer = SimpleImputer()

# initialize ColumnTransformer & specify transformers
preprocessor = ColumnTransformer(
        ('cat', ohe_transformer, ['Embarked', 'Sex']),
        ('num', imputer_transformer, ['Age'])
    ], remainder = 'passthrough')

# apply preprocessor to data X and print results