{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "ae222363-d3a8-9b57-c8fd-67712204ff7b"
      },
      "source": ""
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "b87eb36e-cf3e-fed3-75ea-5101b7ce8eee"
      },
      "outputs": [],
      "source": [
        "# This Python 3 environment comes with many helpful analytics libraries installed\n",
        "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n",
        "# For example, here's several helpful packages to load in \n",
        "\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": "c75a82a3-d9fa-026b-28a8-7489edd70c2a"
      },
      "outputs": [],
      "source": [
        "train = pd.read_csv('../input/train_numeric.csv', usecols = ['Response'], dtype={'Response':'int8'})\n",
        "train.count()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "718585b0-bb2f-6949-d8dc-10c044ebb257"
      },
      "source": [
        "As was promissed, the Response variable is higly unbalanced. Only 6k out of 1M rows have Response = 1"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "5686f723-4757-86b6-8123-523d2ca53027"
      },
      "outputs": [],
      "source": [
        "train['Response'].value_counts()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "22d46565-d514-eb5e-6011-a0c335eefc9b"
      },
      "outputs": [],
      "source": [
        "train = pd.read_csv('../input/train_numeric.csv', nrows = 100000)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "b50aa1ad-3ff3-7fdf-1f91-043612a61622"
      },
      "outputs": [],
      "source": [
        "train.info()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "73b510fb-591a-05b5-ca52-8b4fa0468af3"
      },
      "outputs": [],
      "source": [
        "pd.options.display.max_rows = 1000\n",
        "dsc = train.describe().T\n",
        "dsc"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "8d809f27-1024-ce9b-66d9-ddb4cd4b7f06"
      },
      "outputs": [],
      "source": [
        "dsc.index.name = 'col'\n",
        "dsc.reset_index(inplace = True)\n",
        "dsc['line_no'] = dsc['col'].str.extract('^L(.+?)\\_')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "c1a29cd3-5944-0ba4-9ce5-fa3ce5d4431b"
      },
      "outputs": [],
      "source": [
        "dsc.line_no.value_counts()"
      ]
    }
  ],
  "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.5.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}