application_vnd.jupyter.stderr_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import os

import pandas as pd

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from IPython.display import clear_output
from time import sleep
import os
os.listdir('../input')
train_data = pd.read_csv('../input/training/training.csv')
test_data = pd.read_csv('../input/test/test.csv')
lookid_data = pd.read_csv('../input/IdLookupTable.csv')
train_data.head().T

train_data.isnull().any().value_counts()
train_data.fillna(method='ffill', inplace=True)
train_data.isnull().any().value_counts()

def split_image_feature(data):
    """Return extracted image feature"""
    imag = []
    for i in range(0, data.shape[0]):
        img = data['Image'][i].split(' ')
        img = ['0' if x == '' else x for x in img]
        imag.append(img)
    image_list = np.array(imag, dtype='float')
    X_train = image_list.reshape(-1, 96, 96)
    return X_train
X_train = split_image_feature(train_data)
training = data.drop('Image', axis=1)
y_train = []
for i in range(0, data.shape[0]):
    y = training.iloc[i, :]
    y_train.append(y)
y_train = np.array(y_train, dtype='float')
plt.imshow(X_train[0], cmap='gray')
plt.show()