<commit_before>{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Git in DataFrames\n",
        "\n",
        "python + git + dataframe = [git-pandas](http://wdm0006.github.io/git-pandas/)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div id=\"my_id_menu_nb\">run previous cell, wait for 2 seconds</div>\n",
              "<script>\n",
              "function repeat_indent_string(n){\n",
              "    var a = \"\" ;\n",
              "    for ( ; n > 0 ; --n)\n",
              "        a += \"    \";\n",
              "    return a;\n",
              "}\n",
              "var update_menu_string = function(begin, lfirst, llast, sformat, send, keep_item, begin_format, end_format) {\n",
              "    var anchors = document.getElementsByClassName(\"section\");\n",
              "    if (anchors.length == 0) {\n",
              "        anchors = document.getElementsByClassName(\"text_cell_render rendered_html\");\n",
              "    }\n",
              "    var i,t;\n",
              "    var text_menu = begin;\n",
              "    var text_memo = \"<pre>\\nlength:\" + anchors.length + \"\\n\";\n",
              "    var ind = \"\";\n",
              "    var memo_level = 1;\n",
              "    var href;\n",
              "    var tags = [];\n",
              "    var main_item = 0;\n",
              "    var format_open = 0;\n",
              "    for (i = 0; i <= llast; i++)\n",
              "        tags.push(\"h\" + i);\n",
              "\n",
              "    for (i = 0; i < anchors.length; i++) {\n",
              "        text_memo += \"**\" + anchors[i].id + \"--\\n\";\n",
              "\n",
              "        var child = null;\n",
              "        for(t = 0; t < tags.length; t++) {\n",
              "            var r = anchors[i].getElementsByTagName(tags[t]);\n",
              "            if (r.length > 0) {\n",
              "child = r[0];\n",
              "break;\n",
              "            }\n",
              "        }\n",
              "        if (child == null) {\n",
              "            text_memo += \"null\\n\";\n",
              "            continue;\n",
              "        }\n",
              "        if (anchors[i].hasAttribute(\"id\")) {\n",
              "            // when converted in RST\n",
              "            href = anchors[i].id;\n",
              "            text_memo += \"#1-\" + href;\n",
              "            // passer \u00e0 child suivant (le chercher)\n",
              "        }\n",
              "        else if (child.hasAttribute(\"id\")) {\n",
              "            // in a notebook\n",
              "            href = child.id;\n",
              "            text_memo += \"#2-\" + href;\n",
              "        }\n",
              "        else {\n",
              "            text_memo += \"#3-\" + \"*\" + \"\\n\";\n",
              "            continue;\n",
              "        }\n",
              "        var title = child.textContent;\n",
              "        var level = parseInt(child.tagName.substring(1,2));\n",
              "\n",
              "        text_memo += \"--\" + level + \"?\" + lfirst + \"--\" + title + \"\\n\";\n",
              "\n",
              "        if ((level < lfirst) || (level > llast)) {\n",
              "            continue ;\n",
              "        }\n",
              "        if (title.endsWith('\u00b6')) {\n",
              "            title = title.substring(0,title.length-1).replace(\"<\", \"&lt;\")\n",
              "         .replace(\">\", \"&gt;\").replace(\"&\", \"&amp;\");\n",
              "        }\n",
              "        if (title.length == 0) {\n",
              "            continue;\n",
              "        }\n",
              "\n",
              "        while (level < memo_level) {\n",
              "            text_menu += end_format + \"</ul>\\n\";\n",
              "            format_open -= 1;\n",
              "            memo_level -= 1;\n",
              "        }\n",
              "        if (level == lfirst) {\n",
              "            main_item += 1;\n",
              "        }\n",
              "        if (keep_item != -1 && main_item != keep_item + 1) {\n",
              "            // alert(main_item + \" - \" + level + \" - \" + keep_item);\n",
              "            continue;\n",
              "        }\n",
              "        while (level > memo_level) {\n",
              "            text_menu += \"<ul>\\n\";\n",
              "            memo_level += 1;\n",
              "        }\n",
              "        text_menu += repeat_indent_string(level-2);\n",
              "        text_menu += begin_format + sformat.replace(\"__HREF__\", href).replace(\"__TITLE__\", title);\n",
              "        format_open += 1;\n",
              "    }\n",
              "    while (1 < memo_level) {\n",
              "        text_menu += end_format + \"</ul>\\n\";\n",
              "        memo_level -= 1;\n",
              "        format_open -= 1;\n",
              "    }\n",
              "    text_menu += send;\n",
              "    //text_menu += \"\\n\" + text_memo;\n",
              "\n",
              "    while (format_open > 0) {\n",
              "        text_menu += end_format;\n",
              "        format_open -= 1;\n",
              "    }\n",
              "    return text_menu;\n",
              "};\n",
              "var update_menu = function() {\n",
              "    var sbegin = \"\";\n",
              "    var sformat = '<a href=\"#__HREF__\">__TITLE__</a>';\n",
              "    var send = \"\";\n",
              "    var begin_format = '<li>';\n",
              "    var end_format = '</li>';\n",
              "    var keep_item = -1;\n",
              "    var text_menu = update_menu_string(sbegin, 2, 4, sformat, send, keep_item,\n",
              "       begin_format, end_format);\n",
              "    var menu = document.getElementById(\"my_id_menu_nb\");\n",
              "    menu.innerHTML=text_menu;\n",
              "};\n",
              "window.setTimeout(update_menu,2000);\n",
              "            </script>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "from jyquickhelper import add_notebook_menu\n",
        "add_notebook_menu()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": true
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Repository"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Repository [pyquickhelper] instantiated at directory: ../..\n"
          ]
        }
      ],
      "source": [
        "from gitpandas import Repository\n",
        "tries = [\"../..\", \"../../..\"]\n",
        "err = None\n",
        "for t in tries:\n",
        "    try:\n",
        "        repo = Repository(working_dir=t, verbose=True)\n",
        "        err = None\n",
        "        break\n",
        "    except Exception as e:\n",
        "        err = e\n",
        "        continue\n",
        "if err is not None:\n",
        "    import os\n",
        "    raise Exception(\"issue in current folder '{0}'\".format(os.getcwd())) from err"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>branch</th>\n",
              "      <th>local</th>\n",
              "      <th>repository</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>master</td>\n",
              "      <td>True</td>\n",
              "      <td>pyquickhelper</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>master</td>\n",
              "      <td>False</td>\n",
              "      <td>pyquickhelper</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   branch  local     repository\n",
              "0  master   True  pyquickhelper\n",
              "1  master  False  pyquickhelper"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "repo.branches()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "One funny function. No idea if that gives a good estimation."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>committer</th>\n",
              "      <th>hours</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>ped4747</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>azure provisioned user</td>\n",
              "      <td>2.483333</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td><NAME>r\u00e9</td>\n",
              "      <td>238.348889</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>dupre</td>\n",
              "      <td>515.906667</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>sdpython</td>\n",
              "      <td>107.178611</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                committer       hours\n",
              "0                 ped4747    0.000000\n",
              "1  azure provisioned user    2.483333\n",
              "2            <NAME>r\u00e9  238.348889\n",
              "3                   dupre  515.906667\n",
              "4                sdpython  107.178611"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    use = repo.hours_estimate()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    use = None\n",
        "use"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/plain": [
              "107.98968749999999"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "if use is not None:\n",
        "    workdays = use.hours.sum() / 8\n",
        "else:\n",
        "    workdays = None\n",
        "workdays"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "I might be very slow then :) becauase I think I spend more time than that."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Logs\n",
        "\n",
        "The following cane take some time depending on you repository size."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>author</th>\n",
              "      <th>committer</th>\n",
              "      <th>message</th>\n",
              "      <th>lines</th>\n",
              "      <th>insertions</th>\n",
              "      <th>deletions</th>\n",
              "      <th>net</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>20</td>\n",
              "      <td>14</td>\n",
              "      <td>6</td>\n",
              "      <td>8</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 01:22:39</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug about cached urls in notebooks\\n</td>\n",
              "      <td>4</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 00:51:31</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>documentation\\n</td>\n",
              "      <td>36</td>\n",
              "      <td>18</td>\n",
              "      <td>18</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 23:17:20</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>10</td>\n",
              "      <td>6</td>\n",
              "      <td>4</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 22:49:38</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>19</td>\n",
              "      <td>12</td>\n",
              "      <td>7</td>\n",
              "      <td>5</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                           author     committer  \\\n",
              "date                                              \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 01:22:39  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 00:51:31  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 23:17:20  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 22:49:38  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "\n",
              "                                                               message  lines  \\\n",
              "date                                                                            \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...     20   \n",
              "2017-08-29 01:22:39         fix a bug about cached urls in notebooks\\n      4   \n",
              "2017-08-29 00:51:31                                    documentation\\n     36   \n",
              "2017-08-27 23:17:20                                fix a bug for #67\\n     10   \n",
              "2017-08-27 22:49:38                                fix a bug for #67\\n     19   \n",
              "\n",
              "                     insertions  deletions  net  \n",
              "date                                             \n",
              "2017-08-29 11:46:51          14          6    8  \n",
              "2017-08-29 01:22:39           3          1    2  \n",
              "2017-08-29 00:51:31          18         18    0  \n",
              "2017-08-27 23:17:20           6          4    2  \n",
              "2017-08-27 22:49:38          12          7    5  "
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    hist = repo.commit_history()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    import pandas\n",
        "    hist = pandas.DataFrame()\n",
        "hist.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>author</th>\n",
              "      <th>committer</th>\n",
              "      <th>message</th>\n",
              "      <th>rev</th>\n",
              "      <th>filename</th>\n",
              "      <th>insertions</th>\n",
              "      <th>deletions</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>c8b1e26ac625744df236cd5377f1c62f802e2e1a</td>\n",
              "      <td>_doc/notebooks/git_dataframes.ipynb</td>\n",
              "      <td>10</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td><NAME>r\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>c8b1e26ac625744df236cd5377f1c62f802e2e1a</td>\n",
              "      <td>src/pyquickhelper/helpgen/process_notebooks.py</td>\n",
              "      <td>4</td>\n",
              "      <td>4</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 01:22:39</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug about cached urls in notebooks\\n</td>\n",
              "      <td>3ffde70e558bf1792ea6760a8225052b06f4e041</td>\n",
              "      <td>src/pyquickhelper/ipythonhelper/run_notebook.py</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 00:51:31</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>documentation\\n</td>\n",
              "      <td>951bc20e1d4aef000aea821245736bb1507313da</td>\n",
              "      <td>src/pyquickhelper/ipythonhelper/html_forms.py</td>\n",
              "      <td>18</td>\n",
              "      <td>18</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 23:17:20</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>047dafa61db9dc5b7ec815a3d5e1b4f7c0679659</td>\n",
              "      <td>_unittests/ut_sphinxext/test_blog_helper.py</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                           author     committer  \\\n",
              "date                                              \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 01:22:39  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 00:51:31  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 23:17:20  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "\n",
              "                                                               message  \\\n",
              "date                                                                     \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...   \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...   \n",
              "2017-08-29 01:22:39         fix a bug about cached urls in notebooks\\n   \n",
              "2017-08-29 00:51:31                                    documentation\\n   \n",
              "2017-08-27 23:17:20                                fix a bug for #67\\n   \n",
              "\n",
              "                                                          rev  \\\n",
              "date                                                            \n",
              "2017-08-29 11:46:51  c8b1e26ac625744df236cd5377f1c62f802e2e1a   \n",
              "2017-08-29 11:46:51  c8b1e26ac625744df236cd5377f1c62f802e2e1a   \n",
              "2017-08-29 01:22:39  3ffde70e558bf1792ea6760a8225052b06f4e041   \n",
              "2017-08-29 00:51:31  951bc20e1d4aef000aea821245736bb1507313da   \n",
              "2017-08-27 23:17:20  047dafa61db9dc5b7ec815a3d5e1b4f7c0679659   \n",
              "\n",
              "                                                            filename  \\\n",
              "date                                                                   \n",
              "2017-08-29 11:46:51              _doc/notebooks/git_dataframes.ipynb   \n",
              "2017-08-29 11:46:51   src/pyquickhelper/helpgen/process_notebooks.py   \n",
              "2017-08-29 01:22:39  src/pyquickhelper/ipythonhelper/run_notebook.py   \n",
              "2017-08-29 00:51:31    src/pyquickhelper/ipythonhelper/html_forms.py   \n",
              "2017-08-27 23:17:20      _unittests/ut_sphinxext/test_blog_helper.py   \n",
              "\n",
              "                     insertions  deletions  \n",
              "date                                        \n",
              "2017-08-29 11:46:51          10          2  \n",
              "2017-08-29 11:46:51           4          4  \n",
              "2017-08-29 01:22:39           3          1  \n",
              "2017-08-29 00:51:31          18         18  \n",
              "2017-08-27 23:17:20           3          1  "
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    histf = repo.file_change_history()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    import pandas\n",
        "    hist = pandas.DataFrame()\n",
        "histf.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",<commit_msg>update notebook git_dataframes<commit_after>{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Git in DataFrames\n",
        "\n",
        "python + git + dataframe = [git-pandas](http://wdm0006.github.io/git-pandas/)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div id=\"my_id_menu_nb\">run previous cell, wait for 2 seconds</div>\n",
              "<script>\n",
              "function repeat_indent_string(n){\n",
              "    var a = \"\" ;\n",
              "    for ( ; n > 0 ; --n)\n",
              "        a += \"    \";\n",
              "    return a;\n",
              "}\n",
              "var update_menu_string = function(begin, lfirst, llast, sformat, send, keep_item, begin_format, end_format) {\n",
              "    var anchors = document.getElementsByClassName(\"section\");\n",
              "    if (anchors.length == 0) {\n",
              "        anchors = document.getElementsByClassName(\"text_cell_render rendered_html\");\n",
              "    }\n",
              "    var i,t;\n",
              "    var text_menu = begin;\n",
              "    var text_memo = \"<pre>\\nlength:\" + anchors.length + \"\\n\";\n",
              "    var ind = \"\";\n",
              "    var memo_level = 1;\n",
              "    var href;\n",
              "    var tags = [];\n",
              "    var main_item = 0;\n",
              "    var format_open = 0;\n",
              "    for (i = 0; i <= llast; i++)\n",
              "        tags.push(\"h\" + i);\n",
              "\n",
              "    for (i = 0; i < anchors.length; i++) {\n",
              "        text_memo += \"**\" + anchors[i].id + \"--\\n\";\n",
              "\n",
              "        var child = null;\n",
              "        for(t = 0; t < tags.length; t++) {\n",
              "            var r = anchors[i].getElementsByTagName(tags[t]);\n",
              "            if (r.length > 0) {\n",
              "child = r[0];\n",
              "break;\n",
              "            }\n",
              "        }\n",
              "        if (child == null) {\n",
              "            text_memo += \"null\\n\";\n",
              "            continue;\n",
              "        }\n",
              "        if (anchors[i].hasAttribute(\"id\")) {\n",
              "            // when converted in RST\n",
              "            href = anchors[i].id;\n",
              "            text_memo += \"#1-\" + href;\n",
              "            // passer \u00e0 child suivant (le chercher)\n",
              "        }\n",
              "        else if (child.hasAttribute(\"id\")) {\n",
              "            // in a notebook\n",
              "            href = child.id;\n",
              "            text_memo += \"#2-\" + href;\n",
              "        }\n",
              "        else {\n",
              "            text_memo += \"#3-\" + \"*\" + \"\\n\";\n",
              "            continue;\n",
              "        }\n",
              "        var title = child.textContent;\n",
              "        var level = parseInt(child.tagName.substring(1,2));\n",
              "\n",
              "        text_memo += \"--\" + level + \"?\" + lfirst + \"--\" + title + \"\\n\";\n",
              "\n",
              "        if ((level < lfirst) || (level > llast)) {\n",
              "            continue ;\n",
              "        }\n",
              "        if (title.endsWith('\u00b6')) {\n",
              "            title = title.substring(0,title.length-1).replace(\"<\", \"&lt;\")\n",
              "         .replace(\">\", \"&gt;\").replace(\"&\", \"&amp;\");\n",
              "        }\n",
              "        if (title.length == 0) {\n",
              "            continue;\n",
              "        }\n",
              "\n",
              "        while (level < memo_level) {\n",
              "            text_menu += end_format + \"</ul>\\n\";\n",
              "            format_open -= 1;\n",
              "            memo_level -= 1;\n",
              "        }\n",
              "        if (level == lfirst) {\n",
              "            main_item += 1;\n",
              "        }\n",
              "        if (keep_item != -1 && main_item != keep_item + 1) {\n",
              "            // alert(main_item + \" - \" + level + \" - \" + keep_item);\n",
              "            continue;\n",
              "        }\n",
              "        while (level > memo_level) {\n",
              "            text_menu += \"<ul>\\n\";\n",
              "            memo_level += 1;\n",
              "        }\n",
              "        text_menu += repeat_indent_string(level-2);\n",
              "        text_menu += begin_format + sformat.replace(\"__HREF__\", href).replace(\"__TITLE__\", title);\n",
              "        format_open += 1;\n",
              "    }\n",
              "    while (1 < memo_level) {\n",
              "        text_menu += end_format + \"</ul>\\n\";\n",
              "        memo_level -= 1;\n",
              "        format_open -= 1;\n",
              "    }\n",
              "    text_menu += send;\n",
              "    //text_menu += \"\\n\" + text_memo;\n",
              "\n",
              "    while (format_open > 0) {\n",
              "        text_menu += end_format;\n",
              "        format_open -= 1;\n",
              "    }\n",
              "    return text_menu;\n",
              "};\n",
              "var update_menu = function() {\n",
              "    var sbegin = \"\";\n",
              "    var sformat = '<a href=\"#__HREF__\">__TITLE__</a>';\n",
              "    var send = \"\";\n",
              "    var begin_format = '<li>';\n",
              "    var end_format = '</li>';\n",
              "    var keep_item = -1;\n",
              "    var text_menu = update_menu_string(sbegin, 2, 4, sformat, send, keep_item,\n",
              "       begin_format, end_format);\n",
              "    var menu = document.getElementById(\"my_id_menu_nb\");\n",
              "    menu.innerHTML=text_menu;\n",
              "};\n",
              "window.setTimeout(update_menu,2000);\n",
              "            </script>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "from jyquickhelper import add_notebook_menu\n",
        "add_notebook_menu()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": true
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Repository"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Repository [pyquickhelper] instantiated at directory: ../..\n"
          ]
        }
      ],
      "source": [
        "from gitpandas import Repository\n",
        "tries = [\"../..\", \"../../..\"]\n",
        "err = None\n",
        "for t in tries:\n",
        "    try:\n",
        "        repo = Repository(working_dir=t, verbose=True)\n",
        "        err = None\n",
        "        break\n",
        "    except Exception as e:\n",
        "        err = e\n",
        "        continue\n",
        "if err is not None:\n",
        "    import os\n",
        "    raise Exception(\"issue in current folder '{0}'\".format(os.getcwd())) from err"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>branch</th>\n",
              "      <th>local</th>\n",
              "      <th>repository</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>master</td>\n",
              "      <td>True</td>\n",
              "      <td>pyquickhelper</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>master</td>\n",
              "      <td>False</td>\n",
              "      <td>pyquickhelper</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   branch  local     repository\n",
              "0  master   True  pyquickhelper\n",
              "1  master  False  pyquickhelper"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "repo.branches()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "One funny function. No idea if that gives a good estimation."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>committer</th>\n",
              "      <th>hours</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>ped4747</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>azure provisioned user</td>\n",
              "      <td>2.483333</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>238.348889</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>dupre</td>\n",
              "      <td>515.906667</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>sdpython</td>\n",
              "      <td>107.178611</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                committer       hours\n",
              "0                 ped4747    0.000000\n",
              "1  azure provisioned user    2.483333\n",
              "2            xavier dupr\u00e9  238.348889\n",
              "3                   dupre  515.906667\n",
              "4                sdpython  107.178611"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    use = repo.hours_estimate()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    use = None\n",
        "use"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/plain": [
              "107.98968749999999"
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "if use is not None:\n",
        "    workdays = use.hours.sum() / 8\n",
        "else:\n",
        "    workdays = None\n",
        "workdays"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "I might be very slow then :) becauase I think I spend more time than that."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Logs\n",
        "\n",
        "The following cane take some time depending on you repository size."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>author</th>\n",
              "      <th>committer</th>\n",
              "      <th>message</th>\n",
              "      <th>lines</th>\n",
              "      <th>insertions</th>\n",
              "      <th>deletions</th>\n",
              "      <th>net</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>20</td>\n",
              "      <td>14</td>\n",
              "      <td>6</td>\n",
              "      <td>8</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 01:22:39</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug about cached urls in notebooks\\n</td>\n",
              "      <td>4</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 00:51:31</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>documentation\\n</td>\n",
              "      <td>36</td>\n",
              "      <td>18</td>\n",
              "      <td>18</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 23:17:20</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>10</td>\n",
              "      <td>6</td>\n",
              "      <td>4</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 22:49:38</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>19</td>\n",
              "      <td>12</td>\n",
              "      <td>7</td>\n",
              "      <td>5</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                           author     committer  \\\n",
              "date                                              \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 01:22:39  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 00:51:31  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 23:17:20  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 22:49:38  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "\n",
              "                                                               message  lines  \\\n",
              "date                                                                            \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...     20   \n",
              "2017-08-29 01:22:39         fix a bug about cached urls in notebooks\\n      4   \n",
              "2017-08-29 00:51:31                                    documentation\\n     36   \n",
              "2017-08-27 23:17:20                                fix a bug for #67\\n     10   \n",
              "2017-08-27 22:49:38                                fix a bug for #67\\n     19   \n",
              "\n",
              "                     insertions  deletions  net  \n",
              "date                                             \n",
              "2017-08-29 11:46:51          14          6    8  \n",
              "2017-08-29 01:22:39           3          1    2  \n",
              "2017-08-29 00:51:31          18         18    0  \n",
              "2017-08-27 23:17:20           6          4    2  \n",
              "2017-08-27 22:49:38          12          7    5  "
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    hist = repo.commit_history()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    import pandas\n",
        "    hist = pandas.DataFrame()\n",
        "hist.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "c:\\Python36_x64\\lib\\site-packages\\gitpandas\\repository.py:461: UserWarning: Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead\n",
            "  warnings.warn('Warning, extensions and ignore_dir will be deprecated in v2.0.0, please use ignore_globs instead')\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>author</th>\n",
              "      <th>committer</th>\n",
              "      <th>message</th>\n",
              "      <th>rev</th>\n",
              "      <th>filename</th>\n",
              "      <th>insertions</th>\n",
              "      <th>deletions</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>c8b1e26ac625744df236cd5377f1c62f802e2e1a</td>\n",
              "      <td>_doc/notebooks/git_dataframes.ipynb</td>\n",
              "      <td>10</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 11:46:51</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>changes the display of the coverage, improve a...</td>\n",
              "      <td>c8b1e26ac625744df236cd5377f1c62f802e2e1a</td>\n",
              "      <td>src/pyquickhelper/helpgen/process_notebooks.py</td>\n",
              "      <td>4</td>\n",
              "      <td>4</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 01:22:39</th>\n",
              "      <td><NAME>r\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug about cached urls in notebooks\\n</td>\n",
              "      <td>3ffde70e558bf1792ea6760a8225052b06f4e041</td>\n",
              "      <td>src/pyquickhelper/ipythonhelper/run_notebook.py</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-29 00:51:31</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>documentation\\n</td>\n",
              "      <td>951bc20e1d4aef000aea821245736bb1507313da</td>\n",
              "      <td>src/pyquickhelper/ipythonhelper/html_forms.py</td>\n",
              "      <td>18</td>\n",
              "      <td>18</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2017-08-27 23:17:20</th>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>xavier dupr\u00e9</td>\n",
              "      <td>fix a bug for #67\\n</td>\n",
              "      <td>047dafa61db9dc5b7ec815a3d5e1b4f7c0679659</td>\n",
              "      <td>_unittests/ut_sphinxext/test_blog_helper.py</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                           author     committer  \\\n",
              "date                                              \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 11:46:51  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 01:22:39  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-29 00:51:31  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "2017-08-27 23:17:20  xavier dupr\u00e9  xavier dupr\u00e9   \n",
              "\n",
              "                                                               message  \\\n",
              "date                                                                     \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...   \n",
              "2017-08-29 11:46:51  changes the display of the coverage, improve a...   \n",
              "2017-08-29 01:22:39         fix a bug about cached urls in notebooks\\n   \n",
              "2017-08-29 00:51:31                                    documentation\\n   \n",
              "2017-08-27 23:17:20                                fix a bug for #67\\n   \n",
              "\n",
              "                                                          rev  \\\n",
              "date                                                            \n",
              "2017-08-29 11:46:51  c8b1e26ac625744df236cd5377f1c62f802e2e1a   \n",
              "2017-08-29 11:46:51  c8b1e26ac625744df236cd5377f1c62f802e2e1a   \n",
              "2017-08-29 01:22:39  3ffde70e558bf1792ea6760a8225052b06f4e041   \n",
              "2017-08-29 00:51:31  951bc20e1d4aef000aea821245736bb1507313da   \n",
              "2017-08-27 23:17:20  047dafa61db9dc5b7ec815a3d5e1b4f7c0679659   \n",
              "\n",
              "                                                            filename  \\\n",
              "date                                                                   \n",
              "2017-08-29 11:46:51              _doc/notebooks/git_dataframes.ipynb   \n",
              "2017-08-29 11:46:51   src/pyquickhelper/helpgen/process_notebooks.py   \n",
              "2017-08-29 01:22:39  src/pyquickhelper/ipythonhelper/run_notebook.py   \n",
              "2017-08-29 00:51:31    src/pyquickhelper/ipythonhelper/html_forms.py   \n",
              "2017-08-27 23:17:20      _unittests/ut_sphinxext/test_blog_helper.py   \n",
              "\n",
              "                     insertions  deletions  \n",
              "date                                        \n",
              "2017-08-29 11:46:51          10          2  \n",
              "2017-08-29 11:46:51           4          4  \n",
              "2017-08-29 01:22:39           3          1  \n",
              "2017-08-29 00:51:31          18         18  \n",
              "2017-08-27 23:17:20           3          1  "
            ]
          },
          "execution_count": null,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "try:\n",
        "    histf = repo.file_change_history()\n",
        "except Exception as e:\n",
        "    # Not always reliable.\n",
        "    print(e)\n",
        "    import pandas\n",
        "    histf = pandas.DataFrame(dict(filename=[\"\"]))\n",
        "histf.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style>\n",
              "    .dataframe thead tr:only-child th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: left;\n",
              "    }\n",
{'fraction_non_alphanumeric': 0.17566989859607723, 'fraction_numerical': 0.047435831666068164, 'mean_word_length': 0.9014794342383352, 'pattern_counts': {'":': 220, '<': 791, '<?xml version=': 0, '>': 789, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 84, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3610647', 'n_tokens_mistral': 19864, 'n_tokens_neox': 18254, 'n_words': 2985}