<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from bokeh.charts import HeatMap, output_notebook, show\n",
    "from bokeh.palettes import Blues9 as palette\n",
    "from bokeh.sampledata.unemployment1948 import data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "df = data[data.columns[:-2]]\n",
    "df2 = df.set_index(df[df.columns[0]].astype(str))\n",
    "df2.drop(df.columns[0], axis=1, inplace=True)\n",
    "df3 = df2.transpose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hm = HeatMap(\n",
    "    df3, palette=palette, xlabel='Years since 1948', ylabel='Months', \n",
    "    title=\"Unemployment, pandas input\", height=400, width=1000)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hm_data = df3.values.T\n",
    "hm = HeatMap(\n",
    "    hm_data, palette=palette, xlabel='Years since 1948', ylabel='Months', \n",
    "    title=\"Unemployment, array input\", height=400, width=1000)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "simple_df = pd.DataFrame(\n",
    "    {'apples':[4,5,8,12,4], 'pears':[6,5,4,8,7], 'bananas':[1,2,4,8,12]}, \n",
    "    index=['2009', '2010', '2011', '2012', '2013']\n",
    ")\n",
    "hm = HeatMap(\n",
    "    simple_df, palette=palette, title=\"Fruit comsumption per year\", height=300, width=500)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "try:\n",
    "    from blaze import Data\n",
    "    simple_b = Data(simple_df)\n",
    "    hm = HeatMap(simple_b, palette=palette, title=\"Fruit comsumption per year\", notebook=True, height=400, width=1000)\n",
    "    show(hm)\n",
    "except ImportError:\n",
    "    # seems that blaze is not installed\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}<commit_msg>Update palette order & use data from Jan-Dec<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from bokeh.charts import HeatMap, output_notebook, show\n",
    "from bokeh.palettes import Blues9 as palette\n",
    "palette = palette[::-1]\n",
    "from bokeh.sampledata.unemployment1948 import data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "df = data[data.columns[:-1]]\n",
    "df2 = df.set_index(df[df.columns[0]].astype(str))\n",
    "df2.drop(df.columns[0], axis=1, inplace=True)\n",
    "df3 = df2.transpose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hm = HeatMap(\n",
    "    df3, palette=palette, xlabel='Years since 1948', ylabel='Months', \n",
    "    title=\"Unemployment, pandas input\", height=400, width=1000)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hm_data = df3.values.T\n",
    "hm = HeatMap(\n",
    "    hm_data, palette=palette, xlabel='Years since 1948', ylabel='Months', \n",
    "    title=\"Unemployment, array input\", height=400, width=1000)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "simple_df = pd.DataFrame(\n",
    "    {'apples':[4,5,8,12,4], 'pears':[6,5,4,8,7], 'bananas':[1,2,4,8,12]}, \n",
    "    index=['2009', '2010', '2011', '2012', '2013']\n",
    ")\n",
    "hm = HeatMap(\n",
    "    simple_df, palette=palette, title=\"Fruit comsumption per year\", height=300, width=500)\n",
    "show(hm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "try:\n",
    "    from blaze import Data\n",
    "    simple_b = Data(simple_df)\n",
    "    hm = HeatMap(simple_b, palette=palette, title=\"Fruit comsumption per year\", notebook=True, height=400, width=1000)\n",
    "    show(hm)\n",
    "except ImportError:\n",
    "    # seems that blaze is not installed\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
{'fraction_non_alphanumeric': 0.21774321536264085, 'fraction_numerical': 0.030788763688303442, 'mean_word_length': 2.8240291262135924, 'pattern_counts': {'":': 132, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7376261', 'n_tokens_mistral': 2605, 'n_tokens_neox': 2442, 'n_words': 442}