ml-finance-python

python scripts for finance machine learning

git clone https://9o.is/git/ml-finance-python.git

notebook.ipynb

(31767B)


      1 {
      2  "cells": [
      3   {
      4    "cell_type": "markdown",
      5    "metadata": {
      6     "collapsed": true
      7    },
      8    "source": [
      9     "# EventVestor: Issue Debt\n",
     10     "\n",
     11     "In this notebook, we'll take a look at EventVestor's *Issue Debt* dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans January 01, 2007 through the current day, and documents events and announcements covering new debt issues by companies.\n",
     12     "\n",
     13     "### Blaze\n",
     14     "Before we dig into the data, we want to tell you about how  you generally access Quantopian Store data sets. These datasets are available through an API service known as [Blaze](http://blaze.pydata.org). Blaze provides the Quantopian user with a convenient interface to access very large datasets.\n",
     15     "\n",
     16     "Blaze provides an important function for accessing these datasets. Some of these sets are many millions of records. Bringing that data directly into Quantopian Research directly just is not viable. So Blaze allows us to provide a simple querying interface and shift the burden over to the server side.\n",
     17     "\n",
     18     "It is common to use Blaze to reduce your dataset in size, convert it over to Pandas and then to use Pandas for further computation, manipulation and visualization.\n",
     19     "\n",
     20     "Helpful links:\n",
     21     "* [Query building for Blaze](http://blaze.pydata.org/en/latest/queries.html)\n",
     22     "* [Pandas-to-Blaze dictionary](http://blaze.pydata.org/en/latest/rosetta-pandas.html)\n",
     23     "* [SQL-to-Blaze dictionary](http://blaze.pydata.org/en/latest/rosetta-sql.html).\n",
     24     "\n",
     25     "Once you've limited the size of your Blaze object, you can convert it to a Pandas DataFrames using:\n",
     26     "> `from odo import odo`  \n",
     27     "> `odo(expr, pandas.DataFrame)`\n",
     28     "\n",
     29     "### Free samples and limits\n",
     30     "One other key caveat: we limit the number of results returned from any given expression to 10,000 to protect against runaway memory usage. To be clear, you have access to all the data server side. We are limiting the size of the responses back from Blaze.\n",
     31     "\n",
     32     "There is a *free* version of this dataset as well as a paid one. The free one includes about three years of historical data, though not up to the current day.\n",
     33     "\n",
     34     "With preamble in place, let's get started:"
     35    ]
     36   },
     37   {
     38    "cell_type": "code",
     39    "execution_count": 1,
     40    "metadata": {
     41     "collapsed": false
     42    },
     43    "outputs": [],
     44    "source": [
     45     "# import the dataset\n",
     46     "from quantopian.interactive.data.eventvestor import issue_debt\n",
     47     "# or if you want to import the free dataset, use:\n",
     48     "# from quantopian.interactive.data.eventvestor import issue_debt_free\n",
     49     "\n",
     50     "# import data operations\n",
     51     "from odo import odo\n",
     52     "# import other libraries we will use\n",
     53     "import pandas as pd"
     54    ]
     55   },
     56   {
     57    "cell_type": "code",
     58    "execution_count": 2,
     59    "metadata": {
     60     "collapsed": false
     61    },
     62    "outputs": [
     63     {
     64      "data": {
     65       "text/plain": [
     66        "dshape(\"\"\"var * {\n",
     67        "  event_id: ?float64,\n",
     68        "  asof_date: datetime,\n",
     69        "  trade_date: ?datetime,\n",
     70        "  symbol: ?string,\n",
     71        "  event_type: ?string,\n",
     72        "  event_headline: ?string,\n",
     73        "  issue_amount: ?float64,\n",
     74        "  issue_units: ?string,\n",
     75        "  issue_stage: ?string,\n",
     76        "  event_rating: ?float64,\n",
     77        "  timestamp: datetime,\n",
     78        "  sid: ?int64\n",
     79        "  }\"\"\")"
     80       ]
     81      },
     82      "execution_count": 2,
     83      "metadata": {},
     84      "output_type": "execute_result"
     85     }
     86    ],
     87    "source": [
     88     "# Let's use blaze to understand the data a bit using Blaze dshape()\n",
     89     "issue_debt.dshape"
     90    ]
     91   },
     92   {
     93    "cell_type": "code",
     94    "execution_count": 3,
     95    "metadata": {
     96     "collapsed": false
     97    },
     98    "outputs": [
     99     {
    100      "data": {
    101       "text/html": [
    102        "13844"
    103       ],
    104       "text/plain": [
    105        "13844"
    106       ]
    107      },
    108      "execution_count": 3,
    109      "metadata": {},
    110      "output_type": "execute_result"
    111     }
    112    ],
    113    "source": [
    114     "# And how many rows are there?\n",
    115     "# N.B. we're using a Blaze function to do this, not len()\n",
    116     "issue_debt.count()"
    117    ]
    118   },
    119   {
    120    "cell_type": "code",
    121    "execution_count": 4,
    122    "metadata": {
    123     "collapsed": false
    124    },
    125    "outputs": [
    126     {
    127      "data": {
    128       "text/html": [
    129        "<table border=\"1\" class=\"dataframe\">\n",
    130        "  <thead>\n",
    131        "    <tr style=\"text-align: right;\">\n",
    132        "      <th></th>\n",
    133        "      <th>event_id</th>\n",
    134        "      <th>asof_date</th>\n",
    135        "      <th>trade_date</th>\n",
    136        "      <th>symbol</th>\n",
    137        "      <th>event_type</th>\n",
    138        "      <th>event_headline</th>\n",
    139        "      <th>issue_amount</th>\n",
    140        "      <th>issue_units</th>\n",
    141        "      <th>issue_stage</th>\n",
    142        "      <th>event_rating</th>\n",
    143        "      <th>timestamp</th>\n",
    144        "      <th>sid</th>\n",
    145        "    </tr>\n",
    146        "  </thead>\n",
    147        "  <tbody>\n",
    148        "    <tr>\n",
    149        "      <th>0</th>\n",
    150        "      <td>932000</td>\n",
    151        "      <td>2007-01-02</td>\n",
    152        "      <td>2007-01-02</td>\n",
    153        "      <td>NMRX</td>\n",
    154        "      <td>Issue Debt</td>\n",
    155        "      <td>Numerex to Issue $10M Debt in Private Placement</td>\n",
    156        "      <td>10</td>\n",
    157        "      <td>$M</td>\n",
    158        "      <td>NaN</td>\n",
    159        "      <td>1</td>\n",
    160        "      <td>2007-01-03</td>\n",
    161        "      <td>11002</td>\n",
    162        "    </tr>\n",
    163        "    <tr>\n",
    164        "      <th>1</th>\n",
    165        "      <td>149958</td>\n",
    166        "      <td>2007-01-02</td>\n",
    167        "      <td>2007-01-03</td>\n",
    168        "      <td>TECD</td>\n",
    169        "      <td>Issue Debt</td>\n",
    170        "      <td>Tech Data Completes Sale Of $25M Senior Debent...</td>\n",
    171        "      <td>25</td>\n",
    172        "      <td>$M</td>\n",
    173        "      <td>NaN</td>\n",
    174        "      <td>1</td>\n",
    175        "      <td>2007-01-03</td>\n",
    176        "      <td>7372</td>\n",
    177        "    </tr>\n",
    178        "    <tr>\n",
    179        "      <th>2</th>\n",
    180        "      <td>134612</td>\n",
    181        "      <td>2007-01-04</td>\n",
    182        "      <td>2007-01-04</td>\n",
    183        "      <td>RRD</td>\n",
    184        "      <td>Issue Debt</td>\n",
    185        "      <td>R.R. Donnelley Prices $1.25B Debt Offering</td>\n",
    186        "      <td>1250</td>\n",
    187        "      <td>$M</td>\n",
    188        "      <td>NaN</td>\n",
    189        "      <td>1</td>\n",
    190        "      <td>2007-01-05</td>\n",
    191        "      <td>2248</td>\n",
    192        "    </tr>\n",
    193        "  </tbody>\n",
    194        "</table>"
    195       ],
    196       "text/plain": [
    197        "   event_id  asof_date trade_date symbol  event_type  \\\n",
    198        "0    932000 2007-01-02 2007-01-02   NMRX  Issue Debt   \n",
    199        "1    149958 2007-01-02 2007-01-03   TECD  Issue Debt   \n",
    200        "2    134612 2007-01-04 2007-01-04    RRD  Issue Debt   \n",
    201        "\n",
    202        "                                      event_headline  issue_amount  \\\n",
    203        "0    Numerex to Issue $10M Debt in Private Placement            10   \n",
    204        "1  Tech Data Completes Sale Of $25M Senior Debent...            25   \n",
    205        "2         R.R. Donnelley Prices $1.25B Debt Offering          1250   \n",
    206        "\n",
    207        "  issue_units issue_stage  event_rating  timestamp    sid  \n",
    208        "0          $M         NaN             1 2007-01-03  11002  \n",
    209        "1          $M         NaN             1 2007-01-03   7372  \n",
    210        "2          $M         NaN             1 2007-01-05   2248  "
    211       ]
    212      },
    213      "execution_count": 4,
    214      "metadata": {},
    215      "output_type": "execute_result"
    216     }
    217    ],
    218    "source": [
    219     "# Let's see what the data looks like. We'll grab the first three rows.\n",
    220     "issue_debt[:3]"
    221    ]
    222   },
    223   {
    224    "cell_type": "markdown",
    225    "metadata": {},
    226    "source": [
    227     "Let's go over the columns:\n",
    228     "- **event_id**: the unique identifier for this event.\n",
    229     "- **asof_date**: EventVestor's timestamp of event capture.\n",
    230     "- **trade_date**: for event announcements made before trading ends, trade_date is the same as event_date. For announcements issued after market close, trade_date is next market open day.\n",
    231     "- **symbol**: stock ticker symbol of the affected company.\n",
    232     "- **event_type**: this should always be *Issue Debt*.\n",
    233     "- **event_headline**: a brief description of the event\n",
    234     "- **issue_amount**: value of the debt issued in issue_units \n",
    235     "- **issue_units**: units of the issue_amount, most commonly millions of dollars.\n",
    236     "- **issue_stage**: phase of the issue process: announcement, closing, pricing, etc. Note: currently, there appear to be unrelated entries in this column. We are speaking with the data vendor to amend this.\n",
    237     "- **event_rating**: this is always 1. The meaning of this is uncertain.\n",
    238     "- **timestamp**: this is our timestamp on when we registered the data.\n",
    239     "- **sid**: the equity's unique identifier. Use this instead of the symbol."
    240    ]
    241   },
    242   {
    243    "cell_type": "markdown",
    244    "metadata": {},
    245    "source": [
    246     "We've done much of the data processing for you. Fields like `timestamp` and `sid` are standardized across all our Store Datasets, so the datasets are easy to combine. We have standardized the `sid` across all our equity databases.\n",
    247     "\n",
    248     "We can select columns and rows with ease. Below, we'll fetch all 2015 debt issues smaller than $20M."
    249    ]
    250   },
    251   {
    252    "cell_type": "code",
    253    "execution_count": 5,
    254    "metadata": {
    255     "collapsed": false,
    256     "scrolled": true
    257    },
    258    "outputs": [
    259     {
    260      "data": {
    261       "text/html": [
    262        "<table border=\"1\" class=\"dataframe\">\n",
    263        "  <thead>\n",
    264        "    <tr style=\"text-align: right;\">\n",
    265        "      <th></th>\n",
    266        "      <th>event_id</th>\n",
    267        "      <th>asof_date</th>\n",
    268        "      <th>trade_date</th>\n",
    269        "      <th>symbol</th>\n",
    270        "      <th>event_type</th>\n",
    271        "      <th>event_headline</th>\n",
    272        "      <th>issue_amount</th>\n",
    273        "      <th>issue_units</th>\n",
    274        "      <th>issue_stage</th>\n",
    275        "      <th>event_rating</th>\n",
    276        "      <th>timestamp</th>\n",
    277        "      <th>sid</th>\n",
    278        "    </tr>\n",
    279        "  </thead>\n",
    280        "  <tbody>\n",
    281        "    <tr>\n",
    282        "      <th>0</th>\n",
    283        "      <td>1820589</td>\n",
    284        "      <td>2015-01-06</td>\n",
    285        "      <td>2015-01-07</td>\n",
    286        "      <td>MVC</td>\n",
    287        "      <td>Issue Debt</td>\n",
    288        "      <td>MVC Capital Draws $15.9M from Credit Facility</td>\n",
    289        "      <td>15.900</td>\n",
    290        "      <td>$M</td>\n",
    291        "      <td>Announcement</td>\n",
    292        "      <td>1</td>\n",
    293        "      <td>2015-01-07 00:00:00</td>\n",
    294        "      <td>21667</td>\n",
    295        "    </tr>\n",
    296        "    <tr>\n",
    297        "      <th>1</th>\n",
    298        "      <td>1821690</td>\n",
    299        "      <td>2015-01-09</td>\n",
    300        "      <td>2015-01-09</td>\n",
    301        "      <td>MNTX</td>\n",
    302        "      <td>Issue Debt</td>\n",
    303        "      <td>Manitex International Issues $15M Notes</td>\n",
    304        "      <td>15.000</td>\n",
    305        "      <td>$M</td>\n",
    306        "      <td>Announcement</td>\n",
    307        "      <td>1</td>\n",
    308        "      <td>2015-01-10 00:00:00</td>\n",
    309        "      <td>27042</td>\n",
    310        "    </tr>\n",
    311        "    <tr>\n",
    312        "      <th>2</th>\n",
    313        "      <td>1823391</td>\n",
    314        "      <td>2015-01-14</td>\n",
    315        "      <td>2015-01-15</td>\n",
    316        "      <td>TAT</td>\n",
    317        "      <td>Issue Debt</td>\n",
    318        "      <td>TransAtlantic Petroluem Issues Additional $1.3...</td>\n",
    319        "      <td>1.300</td>\n",
    320        "      <td>$M</td>\n",
    321        "      <td>NaN</td>\n",
    322        "      <td>1</td>\n",
    323        "      <td>2015-01-15 00:00:00</td>\n",
    324        "      <td>38304</td>\n",
    325        "    </tr>\n",
    326        "    <tr>\n",
    327        "      <th>3</th>\n",
    328        "      <td>1830977</td>\n",
    329        "      <td>2015-02-03</td>\n",
    330        "      <td>2015-02-03</td>\n",
    331        "      <td>EBTC</td>\n",
    332        "      <td>Issue Debt</td>\n",
    333        "      <td>Enterprise Bancorp Issues $15M Notes Due 2030</td>\n",
    334        "      <td>15.000</td>\n",
    335        "      <td>$M</td>\n",
    336        "      <td>Announcement</td>\n",
    337        "      <td>1</td>\n",
    338        "      <td>2015-02-04 00:00:00</td>\n",
    339        "      <td>27032</td>\n",
    340        "    </tr>\n",
    341        "    <tr>\n",
    342        "      <th>4</th>\n",
    343        "      <td>1859691</td>\n",
    344        "      <td>2015-02-10</td>\n",
    345        "      <td>2015-02-11</td>\n",
    346        "      <td>TAT</td>\n",
    347        "      <td>Issue Debt</td>\n",
    348        "      <td>TransAtlantic Petroluem Sells Additional $1M C...</td>\n",
    349        "      <td>1.000</td>\n",
    350        "      <td>$M</td>\n",
    351        "      <td>Announcement</td>\n",
    352        "      <td>1</td>\n",
    353        "      <td>2015-02-11 00:00:00</td>\n",
    354        "      <td>38304</td>\n",
    355        "    </tr>\n",
    356        "    <tr>\n",
    357        "      <th>5</th>\n",
    358        "      <td>1860242</td>\n",
    359        "      <td>2015-02-12</td>\n",
    360        "      <td>2015-02-12</td>\n",
    361        "      <td>T</td>\n",
    362        "      <td>Issue Debt</td>\n",
    363        "      <td>AT&amp;T Issues $2.62B Notes Due 2045</td>\n",
    364        "      <td>2.619</td>\n",
    365        "      <td>$M</td>\n",
    366        "      <td>Announcement</td>\n",
    367        "      <td>1</td>\n",
    368        "      <td>2015-02-13 00:00:00</td>\n",
    369        "      <td>6653</td>\n",
    370        "    </tr>\n",
    371        "    <tr>\n",
    372        "      <th>6</th>\n",
    373        "      <td>1860506</td>\n",
    374        "      <td>2015-02-20</td>\n",
    375        "      <td>2015-02-23</td>\n",
    376        "      <td>VGGL</td>\n",
    377        "      <td>Issue Debt</td>\n",
    378        "      <td>Viggle Gets $0.75M Unsecured Demand Loan from ...</td>\n",
    379        "      <td>0.750</td>\n",
    380        "      <td>$M</td>\n",
    381        "      <td>Announcement</td>\n",
    382        "      <td>1</td>\n",
    383        "      <td>2015-02-21 00:00:00</td>\n",
    384        "      <td>31350</td>\n",
    385        "    </tr>\n",
    386        "    <tr>\n",
    387        "      <th>7</th>\n",
    388        "      <td>1852384</td>\n",
    389        "      <td>2015-03-03</td>\n",
    390        "      <td>2015-03-03</td>\n",
    391        "      <td>HPT</td>\n",
    392        "      <td>Issue Debt</td>\n",
    393        "      <td>Mobi724 Global Solutions Completes Third Tranc...</td>\n",
    394        "      <td>0.120</td>\n",
    395        "      <td>$M</td>\n",
    396        "      <td>NaN</td>\n",
    397        "      <td>1</td>\n",
    398        "      <td>2015-03-04 00:00:00</td>\n",
    399        "      <td>13373</td>\n",
    400        "    </tr>\n",
    401        "    <tr>\n",
    402        "      <th>8</th>\n",
    403        "      <td>1845300</td>\n",
    404        "      <td>2015-03-03</td>\n",
    405        "      <td>2015-03-03</td>\n",
    406        "      <td>CNDO</td>\n",
    407        "      <td>Issue Debt</td>\n",
    408        "      <td>Coronado Biosciences Closes $10M Notes Offering</td>\n",
    409        "      <td>10.000</td>\n",
    410        "      <td>$M</td>\n",
    411        "      <td>Announcement</td>\n",
    412        "      <td>1</td>\n",
    413        "      <td>2015-03-04 00:00:00</td>\n",
    414        "      <td>NaN</td>\n",
    415        "    </tr>\n",
    416        "    <tr>\n",
    417        "      <th>9</th>\n",
    418        "      <td>1845300</td>\n",
    419        "      <td>2015-03-03</td>\n",
    420        "      <td>2015-03-03</td>\n",
    421        "      <td>CNDO</td>\n",
    422        "      <td>Issue Debt</td>\n",
    423        "      <td>Coronado Biosciences Closes $10M Notes Offering</td>\n",
    424        "      <td>10.000</td>\n",
    425        "      <td>$M</td>\n",
    426        "      <td>Announcement</td>\n",
    427        "      <td>1</td>\n",
    428        "      <td>2015-09-29 10:53:30.635231</td>\n",
    429        "      <td>NaN</td>\n",
    430        "    </tr>\n",
    431        "    <tr>\n",
    432        "      <th>10</th>\n",
    433        "      <td>1845309</td>\n",
    434        "      <td>2015-03-03</td>\n",
    435        "      <td>2015-03-03</td>\n",
    436        "      <td>MOS</td>\n",
    437        "      <td>Issue Debt</td>\n",
    438        "      <td>Mobi724 Global Solutions Completes Third Tranc...</td>\n",
    439        "      <td>0.120</td>\n",
    440        "      <td>$M</td>\n",
    441        "      <td>NaN</td>\n",
    442        "      <td>1</td>\n",
    443        "      <td>2015-03-04 00:00:00</td>\n",
    444        "      <td>41462</td>\n",
    445        "    </tr>\n",
    446        "  </tbody>\n",
    447        "</table>"
    448       ],
    449       "text/plain": [
    450        "    event_id  asof_date trade_date symbol  event_type  \\\n",
    451        "0    1820589 2015-01-06 2015-01-07    MVC  Issue Debt   \n",
    452        "1    1821690 2015-01-09 2015-01-09   MNTX  Issue Debt   \n",
    453        "2    1823391 2015-01-14 2015-01-15    TAT  Issue Debt   \n",
    454        "3    1830977 2015-02-03 2015-02-03   EBTC  Issue Debt   \n",
    455        "4    1859691 2015-02-10 2015-02-11    TAT  Issue Debt   \n",
    456        "5    1860242 2015-02-12 2015-02-12      T  Issue Debt   \n",
    457        "6    1860506 2015-02-20 2015-02-23   VGGL  Issue Debt   \n",
    458        "7    1852384 2015-03-03 2015-03-03    HPT  Issue Debt   \n",
    459        "8    1845300 2015-03-03 2015-03-03   CNDO  Issue Debt   \n",
    460        "9    1845300 2015-03-03 2015-03-03   CNDO  Issue Debt   \n",
    461        "10   1845309 2015-03-03 2015-03-03    MOS  Issue Debt   \n",
    462        "\n",
    463        "                                       event_headline  issue_amount  \\\n",
    464        "0       MVC Capital Draws $15.9M from Credit Facility        15.900   \n",
    465        "1             Manitex International Issues $15M Notes        15.000   \n",
    466        "2   TransAtlantic Petroluem Issues Additional $1.3...         1.300   \n",
    467        "3       Enterprise Bancorp Issues $15M Notes Due 2030        15.000   \n",
    468        "4   TransAtlantic Petroluem Sells Additional $1M C...         1.000   \n",
    469        "5                   AT&T Issues $2.62B Notes Due 2045         2.619   \n",
    470        "6   Viggle Gets $0.75M Unsecured Demand Loan from ...         0.750   \n",
    471        "7   Mobi724 Global Solutions Completes Third Tranc...         0.120   \n",
    472        "8     Coronado Biosciences Closes $10M Notes Offering        10.000   \n",
    473        "9     Coronado Biosciences Closes $10M Notes Offering        10.000   \n",
    474        "10  Mobi724 Global Solutions Completes Third Tranc...         0.120   \n",
    475        "\n",
    476        "   issue_units   issue_stage  event_rating                  timestamp    sid  \n",
    477        "0           $M  Announcement             1        2015-01-07 00:00:00  21667  \n",
    478        "1           $M  Announcement             1        2015-01-10 00:00:00  27042  \n",
    479        "2           $M           NaN             1        2015-01-15 00:00:00  38304  \n",
    480        "3           $M  Announcement             1        2015-02-04 00:00:00  27032  \n",
    481        "4           $M  Announcement             1        2015-02-11 00:00:00  38304  \n",
    482        "5           $M  Announcement             1        2015-02-13 00:00:00   6653  \n",
    483        "6           $M  Announcement             1        2015-02-21 00:00:00  31350  \n",
    484        "7           $M           NaN             1        2015-03-04 00:00:00  13373  \n",
    485        "8           $M  Announcement             1        2015-03-04 00:00:00    NaN  \n",
    486        "9           $M  Announcement             1 2015-09-29 10:53:30.635231    NaN  \n",
    487        "..."
    488       ]
    489      },
    490      "execution_count": 5,
    491      "metadata": {},
    492      "output_type": "execute_result"
    493     }
    494    ],
    495    "source": [
    496     "issues = issue_debt[('2014-12-31' < issue_debt['asof_date']) & \n",
    497     "                                        (issue_debt['asof_date'] <'2016-01-01') & \n",
    498     "                                        (issue_debt.issue_amount < 20)&\n",
    499     "                                        (issue_debt.issue_units  == \"$M\")]\n",
    500     "# When displaying a Blaze Data Object, the printout is automatically truncated to ten rows.\n",
    501     "issues.sort('asof_date')"
    502    ]
    503   },
    504   {
    505    "cell_type": "markdown",
    506    "metadata": {},
    507    "source": [
    508     "Now suppose we want a DataFrame of the Blaze Data Object above, want to filter it further down to the announcements only, and we only want the sid, issue_amount, and the asof_date."
    509    ]
    510   },
    511   {
    512    "cell_type": "code",
    513    "execution_count": 6,
    514    "metadata": {
    515     "collapsed": false
    516    },
    517    "outputs": [
    518     {
    519      "data": {
    520       "text/html": [
    521        "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
    522        "<table border=\"1\" class=\"dataframe\">\n",
    523        "  <thead>\n",
    524        "    <tr style=\"text-align: right;\">\n",
    525        "      <th></th>\n",
    526        "      <th>sid</th>\n",
    527        "      <th>issue_amount</th>\n",
    528        "      <th>asof_date</th>\n",
    529        "    </tr>\n",
    530        "  </thead>\n",
    531        "  <tbody>\n",
    532        "    <tr>\n",
    533        "      <th>0</th>\n",
    534        "      <td>21667</td>\n",
    535        "      <td>15.9000</td>\n",
    536        "      <td>2015-01-06</td>\n",
    537        "    </tr>\n",
    538        "    <tr>\n",
    539        "      <th>1</th>\n",
    540        "      <td>27042</td>\n",
    541        "      <td>15.0000</td>\n",
    542        "      <td>2015-01-09</td>\n",
    543        "    </tr>\n",
    544        "    <tr>\n",
    545        "      <th>3</th>\n",
    546        "      <td>27032</td>\n",
    547        "      <td>15.0000</td>\n",
    548        "      <td>2015-02-03</td>\n",
    549        "    </tr>\n",
    550        "    <tr>\n",
    551        "      <th>4</th>\n",
    552        "      <td>38304</td>\n",
    553        "      <td>1.0000</td>\n",
    554        "      <td>2015-02-10</td>\n",
    555        "    </tr>\n",
    556        "    <tr>\n",
    557        "      <th>5</th>\n",
    558        "      <td>6653</td>\n",
    559        "      <td>2.6190</td>\n",
    560        "      <td>2015-02-12</td>\n",
    561        "    </tr>\n",
    562        "    <tr>\n",
    563        "      <th>6</th>\n",
    564        "      <td>31350</td>\n",
    565        "      <td>0.7500</td>\n",
    566        "      <td>2015-02-20</td>\n",
    567        "    </tr>\n",
    568        "    <tr>\n",
    569        "      <th>10</th>\n",
    570        "      <td>8151</td>\n",
    571        "      <td>0.7900</td>\n",
    572        "      <td>2015-03-04</td>\n",
    573        "    </tr>\n",
    574        "    <tr>\n",
    575        "      <th>11</th>\n",
    576        "      <td>8151</td>\n",
    577        "      <td>9.9540</td>\n",
    578        "      <td>2015-03-04</td>\n",
    579        "    </tr>\n",
    580        "    <tr>\n",
    581        "      <th>12</th>\n",
    582        "      <td>26723</td>\n",
    583        "      <td>9.3200</td>\n",
    584        "      <td>2015-03-10</td>\n",
    585        "    </tr>\n",
    586        "    <tr>\n",
    587        "      <th>14</th>\n",
    588        "      <td>8151</td>\n",
    589        "      <td>6.9710</td>\n",
    590        "      <td>2015-03-27</td>\n",
    591        "    </tr>\n",
    592        "    <tr>\n",
    593        "      <th>15</th>\n",
    594        "      <td>8151</td>\n",
    595        "      <td>13.2290</td>\n",
    596        "      <td>2015-03-31</td>\n",
    597        "    </tr>\n",
    598        "    <tr>\n",
    599        "      <th>16</th>\n",
    600        "      <td>46731</td>\n",
    601        "      <td>14.9000</td>\n",
    602        "      <td>2015-04-01</td>\n",
    603        "    </tr>\n",
    604        "    <tr>\n",
    605        "      <th>18</th>\n",
    606        "      <td>28632</td>\n",
    607        "      <td>15.0000</td>\n",
    608        "      <td>2015-04-06</td>\n",
    609        "    </tr>\n",
    610        "    <tr>\n",
    611        "      <th>19</th>\n",
    612        "      <td>8151</td>\n",
    613        "      <td>7.1730</td>\n",
    614        "      <td>2015-04-06</td>\n",
    615        "    </tr>\n",
    616        "    <tr>\n",
    617        "      <th>20</th>\n",
    618        "      <td>40551</td>\n",
    619        "      <td>12.5000</td>\n",
    620        "      <td>2015-04-08</td>\n",
    621        "    </tr>\n",
    622        "    <tr>\n",
    623        "      <th>21</th>\n",
    624        "      <td>43721</td>\n",
    625        "      <td>0.3200</td>\n",
    626        "      <td>2015-04-09</td>\n",
    627        "    </tr>\n",
    628        "    <tr>\n",
    629        "      <th>22</th>\n",
    630        "      <td>46731</td>\n",
    631        "      <td>11.2000</td>\n",
    632        "      <td>2015-04-13</td>\n",
    633        "    </tr>\n",
    634        "    <tr>\n",
    635        "      <th>24</th>\n",
    636        "      <td>40197</td>\n",
    637        "      <td>5.0000</td>\n",
    638        "      <td>2015-04-24</td>\n",
    639        "    </tr>\n",
    640        "    <tr>\n",
    641        "      <th>25</th>\n",
    642        "      <td>43552</td>\n",
    643        "      <td>5.0000</td>\n",
    644        "      <td>2015-05-01</td>\n",
    645        "    </tr>\n",
    646        "    <tr>\n",
    647        "      <th>26</th>\n",
    648        "      <td>43367</td>\n",
    649        "      <td>1.5500</td>\n",
    650        "      <td>2015-05-01</td>\n",
    651        "    </tr>\n",
    652        "    <tr>\n",
    653        "      <th>27</th>\n",
    654        "      <td>39803</td>\n",
    655        "      <td>12.5000</td>\n",
    656        "      <td>2015-05-04</td>\n",
    657        "    </tr>\n",
    658        "    <tr>\n",
    659        "      <th>28</th>\n",
    660        "      <td>8151</td>\n",
    661        "      <td>2.3840</td>\n",
    662        "      <td>2015-05-07</td>\n",
    663        "    </tr>\n",
    664        "    <tr>\n",
    665        "      <th>30</th>\n",
    666        "      <td>40197</td>\n",
    667        "      <td>3.8000</td>\n",
    668        "      <td>2015-05-18</td>\n",
    669        "    </tr>\n",
    670        "    <tr>\n",
    671        "      <th>31</th>\n",
    672        "      <td>13046</td>\n",
    673        "      <td>15.0000</td>\n",
    674        "      <td>2015-05-18</td>\n",
    675        "    </tr>\n",
    676        "    <tr>\n",
    677        "      <th>32</th>\n",
    678        "      <td>41233</td>\n",
    679        "      <td>5.0000</td>\n",
    680        "      <td>2015-05-18</td>\n",
    681        "    </tr>\n",
    682        "    <tr>\n",
    683        "      <th>33</th>\n",
    684        "      <td>43721</td>\n",
    685        "      <td>1.5000</td>\n",
    686        "      <td>2015-05-26</td>\n",
    687        "    </tr>\n",
    688        "    <tr>\n",
    689        "      <th>34</th>\n",
    690        "      <td>41717</td>\n",
    691        "      <td>1.0500</td>\n",
    692        "      <td>2015-06-12</td>\n",
    693        "    </tr>\n",
    694        "    <tr>\n",
    695        "      <th>35</th>\n",
    696        "      <td>39627</td>\n",
    697        "      <td>15.0000</td>\n",
    698        "      <td>2015-06-15</td>\n",
    699        "    </tr>\n",
    700        "    <tr>\n",
    701        "      <th>36</th>\n",
    702        "      <td>38327</td>\n",
    703        "      <td>11.6000</td>\n",
    704        "      <td>2015-06-17</td>\n",
    705        "    </tr>\n",
    706        "    <tr>\n",
    707        "      <th>37</th>\n",
    708        "      <td>29204</td>\n",
    709        "      <td>10.0000</td>\n",
    710        "      <td>2015-06-19</td>\n",
    711        "    </tr>\n",
    712        "    <tr>\n",
    713        "      <th>38</th>\n",
    714        "      <td>24475</td>\n",
    715        "      <td>1.5000</td>\n",
    716        "      <td>2015-06-29</td>\n",
    717        "    </tr>\n",
    718        "    <tr>\n",
    719        "      <th>40</th>\n",
    720        "      <td>48506</td>\n",
    721        "      <td>11.7000</td>\n",
    722        "      <td>2015-06-29</td>\n",
    723        "    </tr>\n",
    724        "    <tr>\n",
    725        "      <th>41</th>\n",
    726        "      <td>8151</td>\n",
    727        "      <td>13.9100</td>\n",
    728        "      <td>2015-06-30</td>\n",
    729        "    </tr>\n",
    730        "    <tr>\n",
    731        "      <th>42</th>\n",
    732        "      <td>23901</td>\n",
    733        "      <td>2.0000</td>\n",
    734        "      <td>2015-07-01</td>\n",
    735        "    </tr>\n",
    736        "    <tr>\n",
    737        "      <th>43</th>\n",
    738        "      <td>26904</td>\n",
    739        "      <td>18.5000</td>\n",
    740        "      <td>2015-07-13</td>\n",
    741        "    </tr>\n",
    742        "    <tr>\n",
    743        "      <th>44</th>\n",
    744        "      <td>48998</td>\n",
    745        "      <td>1.0000</td>\n",
    746        "      <td>2015-07-14</td>\n",
    747        "    </tr>\n",
    748        "    <tr>\n",
    749        "      <th>45</th>\n",
    750        "      <td>8151</td>\n",
    751        "      <td>14.4270</td>\n",
    752        "      <td>2015-07-23</td>\n",
    753        "    </tr>\n",
    754        "    <tr>\n",
    755        "      <th>46</th>\n",
    756        "      <td>35352</td>\n",
    757        "      <td>10.0000</td>\n",
    758        "      <td>2015-07-24</td>\n",
    759        "    </tr>\n",
    760        "    <tr>\n",
    761        "      <th>48</th>\n",
    762        "      <td>23714</td>\n",
    763        "      <td>5.0000</td>\n",
    764        "      <td>2015-08-05</td>\n",
    765        "    </tr>\n",
    766        "    <tr>\n",
    767        "      <th>49</th>\n",
    768        "      <td>38327</td>\n",
    769        "      <td>2.6316</td>\n",
    770        "      <td>2015-08-12</td>\n",
    771        "    </tr>\n",
    772        "    <tr>\n",
    773        "      <th>50</th>\n",
    774        "      <td>28414</td>\n",
    775        "      <td>6.0000</td>\n",
    776        "      <td>2015-08-19</td>\n",
    777        "    </tr>\n",
    778        "    <tr>\n",
    779        "      <th>52</th>\n",
    780        "      <td>44040</td>\n",
    781        "      <td>6.6000</td>\n",
    782        "      <td>2015-08-24</td>\n",
    783        "    </tr>\n",
    784        "    <tr>\n",
    785        "      <th>54</th>\n",
    786        "      <td>3343</td>\n",
    787        "      <td>14.1000</td>\n",
    788        "      <td>2015-09-02</td>\n",
    789        "    </tr>\n",
    790        "    <tr>\n",
    791        "      <th>55</th>\n",
    792        "      <td>32481</td>\n",
    793        "      <td>1.5000</td>\n",
    794        "      <td>2015-09-08</td>\n",
    795        "    </tr>\n",
    796        "    <tr>\n",
    797        "      <th>56</th>\n",
    798        "      <td>22039</td>\n",
    799        "      <td>10.0000</td>\n",
    800        "      <td>2015-09-08</td>\n",
    801        "    </tr>\n",
    802        "  </tbody>\n",
    803        "</table>\n",
    804        "</div>"
    805       ],
    806       "text/plain": [
    807        "      sid  issue_amount  asof_date\n",
    808        "0   21667       15.9000 2015-01-06\n",
    809        "1   27042       15.0000 2015-01-09\n",
    810        "3   27032       15.0000 2015-02-03\n",
    811        "4   38304        1.0000 2015-02-10\n",
    812        "5    6653        2.6190 2015-02-12\n",
    813        "6   31350        0.7500 2015-02-20\n",
    814        "10   8151        0.7900 2015-03-04\n",
    815        "11   8151        9.9540 2015-03-04\n",
    816        "12  26723        9.3200 2015-03-10\n",
    817        "14   8151        6.9710 2015-03-27\n",
    818        "15   8151       13.2290 2015-03-31\n",
    819        "16  46731       14.9000 2015-04-01\n",
    820        "18  28632       15.0000 2015-04-06\n",
    821        "19   8151        7.1730 2015-04-06\n",
    822        "20  40551       12.5000 2015-04-08\n",
    823        "21  43721        0.3200 2015-04-09\n",
    824        "22  46731       11.2000 2015-04-13\n",
    825        "24  40197        5.0000 2015-04-24\n",
    826        "25  43552        5.0000 2015-05-01\n",
    827        "26  43367        1.5500 2015-05-01\n",
    828        "27  39803       12.5000 2015-05-04\n",
    829        "28   8151        2.3840 2015-05-07\n",
    830        "30  40197        3.8000 2015-05-18\n",
    831        "31  13046       15.0000 2015-05-18\n",
    832        "32  41233        5.0000 2015-05-18\n",
    833        "33  43721        1.5000 2015-05-26\n",
    834        "34  41717        1.0500 2015-06-12\n",
    835        "35  39627       15.0000 2015-06-15\n",
    836        "36  38327       11.6000 2015-06-17\n",
    837        "37  29204       10.0000 2015-06-19\n",
    838        "38  24475        1.5000 2015-06-29\n",
    839        "40  48506       11.7000 2015-06-29\n",
    840        "41   8151       13.9100 2015-06-30\n",
    841        "42  23901        2.0000 2015-07-01\n",
    842        "43  26904       18.5000 2015-07-13\n",
    843        "44  48998        1.0000 2015-07-14\n",
    844        "45   8151       14.4270 2015-07-23\n",
    845        "46  35352       10.0000 2015-07-24\n",
    846        "48  23714        5.0000 2015-08-05\n",
    847        "49  38327        2.6316 2015-08-12\n",
    848        "50  28414        6.0000 2015-08-19\n",
    849        "52  44040        6.6000 2015-08-24\n",
    850        "54   3343       14.1000 2015-09-02\n",
    851        "55  32481        1.5000 2015-09-08\n",
    852        "56  22039       10.0000 2015-09-08"
    853       ]
    854      },
    855      "execution_count": 6,
    856      "metadata": {},
    857      "output_type": "execute_result"
    858     }
    859    ],
    860    "source": [
    861     "df = odo(issues, pd.DataFrame)\n",
    862     "df = df[df.issue_stage == \"Announcement\"]\n",
    863     "df = df[['sid', 'issue_amount', 'asof_date']].dropna()\n",
    864     "df"
    865    ]
    866   },
    867   {
    868    "cell_type": "code",
    869    "execution_count": null,
    870    "metadata": {
    871     "collapsed": true
    872    },
    873    "outputs": [],
    874    "source": []
    875   }
    876  ],
    877  "metadata": {
    878   "kernelspec": {
    879    "display_name": "Python 2",
    880    "language": "python",
    881    "name": "python2"
    882   },
    883   "language_info": {
    884    "codemirror_mode": {
    885     "name": "ipython",
    886     "version": 2
    887    },
    888    "file_extension": ".py",
    889    "mimetype": "text/x-python",
    890    "name": "python",
    891    "nbconvert_exporter": "python",
    892    "pygments_lexer": "ipython2",
    893    "version": "2.7.10"
    894   }
    895  },
    896  "nbformat": 4,
    897  "nbformat_minor": 0
    898 }