{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "cb2c9099-ae59-3832-f4a5-31665b7ead91"
      },
      "source": [
        "Getting feet wet in understanding the data at hand ..."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "19703c8b-1b68-1289-890a-eb966ca386b4"
      },
      "outputs": [],
      "source": [
        "\n",
        "import numpy as np # linear algebra\n",
        "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
        "\n",
        "# Input data files are available in the \"../input/\" directory.\n",
        "# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n",
        "\n",
        "from subprocess import check_output\n",
        "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n",
        "\n",
        "# Any results you write to the current directory are saved as output."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "0ea8a66e-aa0b-d038-8775-74b307ebafa9"
      },
      "outputs": [],
      "source": [
        "# Generic function to inspect the data\n",
        "def inspectDataFiles(anyDF):\n",
        "    anyDF.head()\n",
        "    anyDFHeader = anyDF.head(0) #Just grabbing the headers\n",
        "\n",
        "    l0Count = len(anyDFHeader.T.filter(like='L0_',axis = 0)) #axis = 0 by row\n",
        "    l1Count = len(anyDFHeader.T.filter(like='L1_',axis = 0)) \n",
        "    l2Count = len(anyDFHeader.T.filter(like='L2_',axis = 0))\n",
        "    l3Count = len(anyDFHeader.T.filter(like='L3_',axis = 0))\n",
        "\n",
        "    print(l0Count, l1Count, l2Count, l3Count)\n",
        "    return"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "b4af8e59-6d08-2259-11f1-97712968c94f"
      },
      "outputs": [],
      "source": [
        "inspectDataFiles#Inspecting the Categorical data\n",
        "\n",
        "trainCategoricalDF = pd.read_csv(\"../input/train_categorical.csv\", nrows = 10)\n",
        "inspectDataFiles(trainCategoricalDF)\n",
        "trainCategoricalDF.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "8cd199b5-2dc6-87a0-d28d-18bfade9eafc"
      },
      "outputs": [],
      "source": [
        "#Inspecting the Numeric data\n",
        "\n",
        "trainNumericDF = pd.read_csv(\"../input/train_numeric.csv\", nrows = 10)\n",
        "inspectDataFiles(trainNumericDF)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "c6fc3f98-6f51-d6f0-81d8-0517357cd7fe"
      },
      "outputs": [],
      "source": [
        "#Inspecting the Date data\n",
        "\n",
        "trainDateDF = pd.read_csv(\"../input/train_date.csv\", nrows = 10)\n",
        "inspectDataFiles(trainDateDF)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "2ecc6f12-ae31-ec29-7eea-b944ef88a0bf"
      },
      "outputs": [],
      "source": [
        "trainCategoricalDF = pd.read_csv(\"../input/train_categorical.csv\", nrows = 10)\n",
        "inspectDataFiles(trainCategoricalDF)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "c6e1e6b4-b6b0-4200-ceb2-481474253db9"
      },
      "outputs": [],
      "source": [
        "trainNumericDF = pd.read_csv(\"../input/train_numeric.csv\", nrows = 10)\n",
        "inspectDataFiles(trainNumericDF)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "702ef9f7-8b27-3db7-84d7-549af1c9da05"
      },
      "outputs": [],
      "source": [
        "trainDateDF = pd.read_csv(\"../input/train_date.csv\", nrows = 10)\n",
        "inspectDataFiles(trainDateDF)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "eab8c736-3776-5d89-a526-81761c55f7e6"
      },
      "outputs": [],
      "source": [
        "#Inspecting the Numeric data values - TRAIN\n",
        "\n",
        "trainNumericDF = pd.read_csv(\"../input/train_numeric.csv\", nrows = 1000)\n",
        "trainNumericDF[['Response','Id']].groupby(['Response']).agg(['count'])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "ac2014f7-a563-08d1-33d3-126de60941ba"
      },
      "outputs": [],
      "source": [
        "testNumericDF = pd.read_csv(\"../input/test_numeric.csv\", nrows = 1000)\n",
        "testNumericDF.head().filter(like = 'Response', axis = 0)\n",
        "#testNumericDF[['Response']]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "c930c36f-98bc-ebe3-9246-1f0dde5a608e"
      },
      "outputs": [],
      "source": [
        "#Inspecting the Numeric data values - TEST\n",
        "\n",
        "testNumericDF = pd.read_csv(\"../input/test_numeric.csv\", nrows = 1000)\n",
        "testNumericDF[['Response','Id']].groupby(['Response']).agg(['count'])"
      ]
    }
  ],
  "metadata": {
    "_change_revision": 0,
    "_is_fork": false,
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.6.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}