{
 "metadata": {
  "name": "",
  "signature": "sha256:2ee46e54facbe64a0599cd359cddda0bc6515ca62128c78291afa7c0c99b9a4f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import bokeh\n",
      "bokeh.load_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from collections import OrderedDict\n",
      "import pandas as pd\n",
      "from bokeh.charts import TimeSeries\n",
      "\n",
      "# Here is some code to read in some stock data from the Yahoo Finance API\n",
      "AAPL = pd.read_csv(\n",
      "    \"http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
      "    parse_dates=['Date'])\n",
      "MSFT = pd.read_csv(\n",
      "    \"http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
      "    parse_dates=['Date'])\n",
      "IBM = pd.read_csv(\n",
      "    \"http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
      "    parse_dates=['Date'])\n",
      "\n",
      "xyvalues = OrderedDict(\n",
      "    AAPL=AAPL['Adj Close'],\n",
      "    Date=AAPL['Date'],\n",
      "    MSFT=MSFT['Adj Close'],\n",
      "    IBM=IBM['Adj Close'],\n",
      ")\n",
      "\n",
      "ts = TimeSeries(xyvalues, index='Date', title=\"timeseries, pd_input\", ylabel='Stock Prices', notebook=True)\n",
      "ts.legend(\"top_left\").show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import pandas as pd\n",
      "\n",
      "df = pd.DataFrame(xyvalues)\n",
      "ts = TimeSeries(df, index='Date', title=\"timeseries, pd_input\", notebook=True)\n",
      "ts.legend(\"top_left\").show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lindex = xyvalues.pop('Date')\n",
      "lxyvalues = list(xyvalues.values())\n",
      "\n",
      "ts = TimeSeries(lxyvalues, index=lindex, title=\"timeseries, pd_input\", notebook=True)\n",
      "ts.ylabel('Stock Prices: 1-AAPL, 2-IBM, 3-MSFT')\n",
      "ts.legend(\"top_left\").show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ts.facet().show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}
