{"cells":[
 {
  "cell_type": "code",
  "execution_count": null,
  "metadata": {
   "collapsed": false
  },
  "outputs": [],
  "source": "import numpy as np\nimport pandas as pd\nfrom matplotlib import pyplot as plt\nfrom math import ceil\n%matplotlib inline"
 },
 {
  "cell_type": "code",
  "execution_count": null,
  "metadata": {
   "collapsed": false
  },
  "outputs": [],
  "source": "N_COLS = 5\nPLOT_SIZE = 3\n\ndef show_digit(row_id, row, ax):\n    \n    ax.imshow(row['pixel0':].reshape(28, 28), cmap='gray_r')\n    ax.set_title('row_id: %d label: %d' % (row_id, row['label']))\n    \ndef show_digits(x):\n    \n    num_digits = x.shape[0]\n    num_rows = int(ceil((num_digits / N_COLS)))\n    \n    fig, axes = plt.subplots(num_rows, N_COLS, figsize=(PLOT_SIZE*N_COLS, PLOT_SIZE*num_rows))\n    \n    for ax, (row_id, row) in zip(axes.ravel(), x.iterrows()):\n        \n        show_digit(row_id, row, ax)"
 },
 {
  "cell_type": "code",
  "execution_count": null,
  "metadata": {
   "collapsed": false
  },
  "outputs": [],
  "source": "train = pd.read_csv('../input/train.csv')"
 },
 {
  "cell_type": "code",
  "execution_count": null,
  "metadata": {
   "collapsed": false
  },
  "outputs": [],
  "source": "show_digits(train.loc[1030:1054, :])"
 },
 {
  "cell_type": "code",
  "execution_count": null,
  "metadata": {
   "collapsed": false
  },
  "outputs": [],
  "source": ""
 }
],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"}}, "nbformat": 4, "nbformat_minor": 0}