image_output_1.png
import numpy as np

import pandas as pd

train_csv_df = pd.read_csv('../input/train.csv')
test_csv_df = pd.read_csv('../input/test.csv')
y_train = np.array(train_csv_df['label'])
X_train = np.array(train_csv_df.drop('label', 1))
X_test = np.array(test_csv_df)

count = 0
for index in range(0, 6):
    plt.subplot(2, 3, count + 1)
    plt.title(y_train[index])
    plt.imshow(X_train[index].reshape(28, 28), cmap='gray')
    count += 1
plt.show()