{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "77ba225c-15bc-44b4-0b8b-d1ccb22e1536"
      },
      "source": [
        "# EDA for this competition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "1fe93475-e005-a360-c476-342b128cefb3"
      },
      "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": "686e1477-c3c5-2e9c-a83a-b7de261e390c"
      },
      "outputs": [],
      "source": [
        "print(check_output([\"ls\", \"../input/train\"]).decode(\"utf8\"))\n",
        "print(check_output([\"ls\", \"../input/additional\"]).decode(\"utf8\"))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "f9ae050a-3848-9387-d94a-d203be9bc88d"
      },
      "outputs": [],
      "source": [
        "# Tanks for Philipp Schmidt in https://www.kaggle.com/philschmidt/intel-mobileodt-cervical-cancer-screening/cervix-eda\n",
        "from glob import glob\n",
        "basepath = '../input/train/'\n",
        "\n",
        "all_cervix_images = []\n",
        "\n",
        "for path in glob(basepath + \"*\"):\n",
        "    cervix_type = path.split(\"/\")[-1]\n",
        "    cervix_images = glob(basepath + cervix_type + \"/*\")\n",
        "    all_cervix_images = all_cervix_images + cervix_images\n",
        "\n",
        "all_cervix_images = pd.DataFrame({'imagepath': all_cervix_images})\n",
        "all_cervix_images['filetype'] = all_cervix_images.apply(lambda row: row.imagepath.split(\".\")[-1], axis=1)\n",
        "all_cervix_images['type'] = all_cervix_images.apply(lambda row: row.imagepath.split(\"/\")[-2], axis=1)\n",
        "all_cervix_images.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "06456204-4cdc-691a-39f5-500d3cfb2cac"
      },
      "outputs": [],
      "source": [
        "all_cervix_images.shape"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "a67797a4-4cec-eea2-708f-a2d1765fda30"
      },
      "outputs": [],
      "source": [
        ""
      ]
    }
  ],
  "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
}