image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

train_data = pd.read_csv('../input/digit-recognizer/train.csv')
test_data = pd.read_csv('../input/digit-recognizer/test.csv') / 255

# Figure size
plt.figure(figsize=(8,8))

# Subplot
for i in range(9):
    img = np.asarray(train_data.iloc[i+180,1:].values.reshape((28,28))/255)
    ax=plt.subplot(3, 3, i+1)
    ax.grid(False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    ax.title.set_text(f'{train_data.iloc[i+18,0]}')
    plt.imshow(img, cmap='gray')
    
plt.show()

plt.figure(figsize=(8, 4))
sns.countplot(x='label', data=train_data)
plt.title('Distribution of labels in training set')