text_html_output_1.png
import numpy as np

import pandas as pd

train_dataset = pd.read_csv('../input/house-prices-advanced-regression-techniques/train.csv')
test_dataset = pd.read_csv('../input/house-prices-advanced-regression-techniques/test.csv')

train_dataset.fillna(0, inplace=True)
test_dataset.fillna(0, inplace=True)

train_dataset.isnull().sum()

copy_train_dataset = train_dataset.copy()

def non_numeric_data(df):
    columns = df.columns.values
    for column in columns:
        text_digit = {}
        def convert_to_int(key):
            return text_digit[key]
        if df[column].dtype != np.int64 and df[column].dtype != np.float64:
            column_content = df[column].values.tolist()
            unique_elements = set(column_content)
            x = 0
            for unique in unique_elements:
                if unique not in text_digit:
                    text_digit[unique] = x
                    x = x + 1
            df[column] = list(map(convert_to_int, df[column]))
    return df

non_numeric_train = non_numeric_data(copy_train_dataset)

non_numeric_train.head()