{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "f16e34e4-71ad-05bf-af6c-8668b9d4d73e"
      },
      "outputs": [],
      "source": [
        "import numpy as np \n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "train=pd.read_csv('../input/train_numeric.csv', usecols=['Id','Response'])\n",
        "failure_ids = sorted(train[train['Response']==1]['Id'].values)\n",
        "count = {}\n",
        "for i in range(1, len(failure_ids)):\n",
        "    d = abs(failure_ids[i] - failure_ids[i-1])\n",
        "    if d not in count:\n",
        "        count[d] = 0            \n",
        "    count[d] = count[d] + 1\n",
        "\n",
        "near = {k:v for k,v in count.items() if k < 10 or v > 50}\n",
        "plt.bar(near.keys(), near.values())\n",
        "\n"
      ]
    }
  ],
  "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
}