text_html_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

people = pd.read_csv('../input/people.csv')
activity_train = pd.read_csv('../input/act_train.csv')
activity_test = pd.read_csv('../input/act_test.csv')

df = activity_train.merge(people, how='left', on='people_id')
df_test = activity_test.merge(people, how='left', on='people_id')

df = df.fillna('0', axis=0)
df_test = df_test.fillna('0', axis=0)

class MultiColumnLabelEncoder:
    def __init__(self, columns=None):
        self.columns = columns
    def fit(self, X, y=None):
        return self
    def transform(self, X):
        output = X.copy()
        if self.columns is not None:
            for col in self.columns:
                output[col] = LabelEncoder().fit_transform(output[col])
        else:
            for colname, col in output.iteritems():
                output[colname] = LabelEncoder().fit_transform(col)
        return output
    def fit_transform(self, X, y=None):
        return self.fit(X, y).transform(X)

def processor(data):
    data = MultiColumnLabelEncoder(columns=['people_id', 'activity_id', 'activity_category', 'date_x', 'char_1_x', 'char_2_x', 'char_3_x', 'char_4_x', 'char_5_x', 'char_6_x', 'char_7_x', 'char_8_x', 'char_9_x', 'char_10_x', 'char_1_y', 'group_1', 'char_2_y', 'date_y', 'char_3_y', 'char_4_y', 'char_5_y', 'char_6_y', 'char_7_y', 'char_8_y', 'char_9_y']).fit_transform(df)
    bool_map = {True: 1, False: 0}
    data = data.applymap(lambda x: bool_map.get(x, x))
    return data

df_encoded = processor(df)

df_encoded.dtypes

X = df_encoded
y = X.pop('outcome')

print(X.shape)
print(y.shape)