ml-finance-python
python scripts for finance machine learning
git clone https://9o.is/git/ml-finance-python.git
notebook.ipynb
(41670B)
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {
6 "collapsed": true
7 },
8 "source": [
9 "# EventVestor: Credit Facility\n",
10 "\n",
11 "In this notebook, we'll take a look at EventVestor's *Credit Facility* dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans January 01, 2007 through the current day, and documents financial events covering new or extended credit facilities.\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": 3,
40 "metadata": {
41 "collapsed": false
42 },
43 "outputs": [],
44 "source": [
45 "# import the dataset\n",
46 "from quantopian.interactive.data.eventvestor import credit_facility\n",
47 "# or if you want to import the free dataset, use:\n",
48 "# from quantopian.data.eventvestor import credit_facility_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": 4,
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 " credit_amount: ?float64,\n",
74 " credit_units: ?string,\n",
75 " event_rating: ?float64,\n",
76 " timestamp: datetime,\n",
77 " sid: ?int64\n",
78 " }\"\"\")"
79 ]
80 },
81 "execution_count": 4,
82 "metadata": {},
83 "output_type": "execute_result"
84 }
85 ],
86 "source": [
87 "# Let's use blaze to understand the data a bit using Blaze dshape()\n",
88 "credit_facility.dshape"
89 ]
90 },
91 {
92 "cell_type": "code",
93 "execution_count": 5,
94 "metadata": {
95 "collapsed": false
96 },
97 "outputs": [
98 {
99 "data": {
100 "text/html": [
101 "8000"
102 ],
103 "text/plain": [
104 "8000"
105 ]
106 },
107 "execution_count": 5,
108 "metadata": {},
109 "output_type": "execute_result"
110 }
111 ],
112 "source": [
113 "# And how many rows are there?\n",
114 "# N.B. we're using a Blaze function to do this, not len()\n",
115 "credit_facility.count()"
116 ]
117 },
118 {
119 "cell_type": "code",
120 "execution_count": 6,
121 "metadata": {
122 "collapsed": false
123 },
124 "outputs": [
125 {
126 "data": {
127 "text/html": [
128 "<table border=\"1\" class=\"dataframe\">\n",
129 " <thead>\n",
130 " <tr style=\"text-align: right;\">\n",
131 " <th></th>\n",
132 " <th>event_id</th>\n",
133 " <th>asof_date</th>\n",
134 " <th>trade_date</th>\n",
135 " <th>symbol</th>\n",
136 " <th>event_type</th>\n",
137 " <th>event_headline</th>\n",
138 " <th>credit_amount</th>\n",
139 " <th>credit_units</th>\n",
140 " <th>event_rating</th>\n",
141 " <th>timestamp</th>\n",
142 " <th>sid</th>\n",
143 " </tr>\n",
144 " </thead>\n",
145 " <tbody>\n",
146 " <tr>\n",
147 " <th>0</th>\n",
148 " <td>78219</td>\n",
149 " <td>2007-01-03</td>\n",
150 " <td>2007-01-03</td>\n",
151 " <td>NVLS</td>\n",
152 " <td>Credit Facility</td>\n",
153 " <td>Novellus Signs $150M Credit Facility</td>\n",
154 " <td>150</td>\n",
155 " <td>$M</td>\n",
156 " <td>1</td>\n",
157 " <td>2007-01-04</td>\n",
158 " <td>5509</td>\n",
159 " </tr>\n",
160 " <tr>\n",
161 " <th>1</th>\n",
162 " <td>961784</td>\n",
163 " <td>2007-01-04</td>\n",
164 " <td>2007-01-04</td>\n",
165 " <td>NAV</td>\n",
166 " <td>Credit Facility</td>\n",
167 " <td>Navistar International Gets $1.3B Credit Facil...</td>\n",
168 " <td>1300</td>\n",
169 " <td>$M</td>\n",
170 " <td>1</td>\n",
171 " <td>2007-01-05</td>\n",
172 " <td>5199</td>\n",
173 " </tr>\n",
174 " <tr>\n",
175 " <th>2</th>\n",
176 " <td>145867</td>\n",
177 " <td>2007-01-10</td>\n",
178 " <td>2007-01-10</td>\n",
179 " <td>CCI</td>\n",
180 " <td>Credit Facility</td>\n",
181 " <td>Crown Castle Signs $250M Revolving Credit Faci...</td>\n",
182 " <td>250</td>\n",
183 " <td>$M</td>\n",
184 " <td>1</td>\n",
185 " <td>2007-01-11</td>\n",
186 " <td>19258</td>\n",
187 " </tr>\n",
188 " </tbody>\n",
189 "</table>"
190 ],
191 "text/plain": [
192 " event_id asof_date trade_date symbol event_type \\\n",
193 "0 78219 2007-01-03 2007-01-03 NVLS Credit Facility \n",
194 "1 961784 2007-01-04 2007-01-04 NAV Credit Facility \n",
195 "2 145867 2007-01-10 2007-01-10 CCI Credit Facility \n",
196 "\n",
197 " event_headline credit_amount \\\n",
198 "0 Novellus Signs $150M Credit Facility 150 \n",
199 "1 Navistar International Gets $1.3B Credit Facil... 1300 \n",
200 "2 Crown Castle Signs $250M Revolving Credit Faci... 250 \n",
201 "\n",
202 " credit_units event_rating timestamp sid \n",
203 "0 $M 1 2007-01-04 5509 \n",
204 "1 $M 1 2007-01-05 5199 \n",
205 "2 $M 1 2007-01-11 19258 "
206 ]
207 },
208 "execution_count": 6,
209 "metadata": {},
210 "output_type": "execute_result"
211 }
212 ],
213 "source": [
214 "# Let's see what the data looks like. We'll grab the first three rows.\n",
215 "credit_facility[:3]"
216 ]
217 },
218 {
219 "cell_type": "markdown",
220 "metadata": {},
221 "source": [
222 "Let's go over the columns:\n",
223 "- **event_id**: the unique identifier for this event.\n",
224 "- **asof_date**: EventVestor's timestamp of event capture.\n",
225 "- **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",
226 "- **symbol**: stock ticker symbol of the affected company.\n",
227 "- **event_type**: this should always be *Credit Facility/Credit facility*.\n",
228 "- **event_headline**: a brief description of the event\n",
229 "- **credit_amount**: the amount of credit_units being availed\n",
230 "- **credit_units**: the units for credit_amount: currency or other value. Most commonly in millions of USD.\n",
231 "- **event_rating**: this is always 1. The meaning of this is uncertain.\n",
232 "- **timestamp**: this is our timestamp on when we registered the data.\n",
233 "- **sid**: the equity's unique identifier. Use this instead of the symbol."
234 ]
235 },
236 {
237 "cell_type": "markdown",
238 "metadata": {},
239 "source": [
240 "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",
241 "\n",
242 "We can select columns and rows with ease. Below, we'll fetch all events in which \\$ 200M of credit was availed."
243 ]
244 },
245 {
246 "cell_type": "code",
247 "execution_count": 7,
248 "metadata": {
249 "collapsed": false,
250 "scrolled": true
251 },
252 "outputs": [
253 {
254 "data": {
255 "text/html": [
256 "<table border=\"1\" class=\"dataframe\">\n",
257 " <thead>\n",
258 " <tr style=\"text-align: right;\">\n",
259 " <th></th>\n",
260 " <th>event_id</th>\n",
261 " <th>asof_date</th>\n",
262 " <th>trade_date</th>\n",
263 " <th>symbol</th>\n",
264 " <th>event_type</th>\n",
265 " <th>event_headline</th>\n",
266 " <th>credit_amount</th>\n",
267 " <th>credit_units</th>\n",
268 " <th>event_rating</th>\n",
269 " <th>timestamp</th>\n",
270 " <th>sid</th>\n",
271 " </tr>\n",
272 " </thead>\n",
273 " <tbody>\n",
274 " <tr>\n",
275 " <th>0</th>\n",
276 " <td>910312</td>\n",
277 " <td>2007-01-16</td>\n",
278 " <td>2007-01-16</td>\n",
279 " <td>CPNO</td>\n",
280 " <td>Credit Facility</td>\n",
281 " <td>Copano Energy Completes Amendment of $200M Cre...</td>\n",
282 " <td>200</td>\n",
283 " <td>$M</td>\n",
284 " <td>1</td>\n",
285 " <td>2007-01-17</td>\n",
286 " <td>26783</td>\n",
287 " </tr>\n",
288 " <tr>\n",
289 " <th>1</th>\n",
290 " <td>965519</td>\n",
291 " <td>2007-01-22</td>\n",
292 " <td>2007-01-22</td>\n",
293 " <td>NAV</td>\n",
294 " <td>Credit Facility</td>\n",
295 " <td>Navistar International Raises Credit Facility ...</td>\n",
296 " <td>200</td>\n",
297 " <td>$M</td>\n",
298 " <td>1</td>\n",
299 " <td>2007-01-23</td>\n",
300 " <td>5199</td>\n",
301 " </tr>\n",
302 " <tr>\n",
303 " <th>2</th>\n",
304 " <td>133561</td>\n",
305 " <td>2007-03-13</td>\n",
306 " <td>2007-03-13</td>\n",
307 " <td>SIAL</td>\n",
308 " <td>Credit Facility</td>\n",
309 " <td>Sigma-Aldrich Announces New European Credit Fa...</td>\n",
310 " <td>200</td>\n",
311 " <td>$M</td>\n",
312 " <td>1</td>\n",
313 " <td>2007-03-14</td>\n",
314 " <td>6872</td>\n",
315 " </tr>\n",
316 " <tr>\n",
317 " <th>3</th>\n",
318 " <td>131670</td>\n",
319 " <td>2007-05-04</td>\n",
320 " <td>2007-05-04</td>\n",
321 " <td>LEG</td>\n",
322 " <td>Credit Facility</td>\n",
323 " <td>Leggett & Platt Increases Multi-Currency Credi...</td>\n",
324 " <td>200</td>\n",
325 " <td>$M</td>\n",
326 " <td>1</td>\n",
327 " <td>2007-05-05</td>\n",
328 " <td>4415</td>\n",
329 " </tr>\n",
330 " <tr>\n",
331 " <th>4</th>\n",
332 " <td>125820</td>\n",
333 " <td>2007-05-31</td>\n",
334 " <td>2007-05-31</td>\n",
335 " <td>ABI</td>\n",
336 " <td>Credit Facility</td>\n",
337 " <td>Applera Signs $200M Credit Agreement</td>\n",
338 " <td>200</td>\n",
339 " <td>$M</td>\n",
340 " <td>1</td>\n",
341 " <td>2007-06-01</td>\n",
342 " <td>25270</td>\n",
343 " </tr>\n",
344 " <tr>\n",
345 " <th>5</th>\n",
346 " <td>961810</td>\n",
347 " <td>2007-06-15</td>\n",
348 " <td>2007-06-15</td>\n",
349 " <td>NAV</td>\n",
350 " <td>Credit Facility</td>\n",
351 " <td>Navistar International Unit Gets $200M Credit ...</td>\n",
352 " <td>200</td>\n",
353 " <td>$M</td>\n",
354 " <td>1</td>\n",
355 " <td>2007-06-16</td>\n",
356 " <td>5199</td>\n",
357 " </tr>\n",
358 " <tr>\n",
359 " <th>6</th>\n",
360 " <td>78520</td>\n",
361 " <td>2007-07-25</td>\n",
362 " <td>2007-07-25</td>\n",
363 " <td>JBL</td>\n",
364 " <td>Credit Facility</td>\n",
365 " <td>Jabil Increases Credit Facility to $1B</td>\n",
366 " <td>200</td>\n",
367 " <td>$M</td>\n",
368 " <td>1</td>\n",
369 " <td>2007-07-26</td>\n",
370 " <td>8831</td>\n",
371 " </tr>\n",
372 " <tr>\n",
373 " <th>7</th>\n",
374 " <td>91869</td>\n",
375 " <td>2007-09-17</td>\n",
376 " <td>2007-09-17</td>\n",
377 " <td>AYE</td>\n",
378 " <td>Credit Facility</td>\n",
379 " <td>Allegheny Increases Credit Facility to $400M</td>\n",
380 " <td>200</td>\n",
381 " <td>$M</td>\n",
382 " <td>1</td>\n",
383 " <td>2007-09-18</td>\n",
384 " <td>17618</td>\n",
385 " </tr>\n",
386 " <tr>\n",
387 " <th>8</th>\n",
388 " <td>93042</td>\n",
389 " <td>2007-09-18</td>\n",
390 " <td>2007-09-18</td>\n",
391 " <td>AIV</td>\n",
392 " <td>Credit Facility</td>\n",
393 " <td>AIMCO Increases Credit Facility by $200M</td>\n",
394 " <td>200</td>\n",
395 " <td>$M</td>\n",
396 " <td>1</td>\n",
397 " <td>2007-09-19</td>\n",
398 " <td>11598</td>\n",
399 " </tr>\n",
400 " <tr>\n",
401 " <th>9</th>\n",
402 " <td>140305</td>\n",
403 " <td>2007-10-04</td>\n",
404 " <td>2007-10-04</td>\n",
405 " <td>NTRI</td>\n",
406 " <td>Credit Facility</td>\n",
407 " <td>Nutri/System Establishes $200M Credit Facility</td>\n",
408 " <td>200</td>\n",
409 " <td>$M</td>\n",
410 " <td>1</td>\n",
411 " <td>2007-10-05</td>\n",
412 " <td>21697</td>\n",
413 " </tr>\n",
414 " <tr>\n",
415 " <th>10</th>\n",
416 " <td>138791</td>\n",
417 " <td>2007-11-07</td>\n",
418 " <td>2007-11-07</td>\n",
419 " <td>WTI</td>\n",
420 " <td>Credit Facility</td>\n",
421 " <td>W&T Expands Credit Facility by $200M to $500M</td>\n",
422 " <td>200</td>\n",
423 " <td>$M</td>\n",
424 " <td>1</td>\n",
425 " <td>2007-11-08</td>\n",
426 " <td>26986</td>\n",
427 " </tr>\n",
428 " </tbody>\n",
429 "</table>"
430 ],
431 "text/plain": [
432 " event_id asof_date trade_date symbol event_type \\\n",
433 "0 910312 2007-01-16 2007-01-16 CPNO Credit Facility \n",
434 "1 965519 2007-01-22 2007-01-22 NAV Credit Facility \n",
435 "2 133561 2007-03-13 2007-03-13 SIAL Credit Facility \n",
436 "3 131670 2007-05-04 2007-05-04 LEG Credit Facility \n",
437 "4 125820 2007-05-31 2007-05-31 ABI Credit Facility \n",
438 "5 961810 2007-06-15 2007-06-15 NAV Credit Facility \n",
439 "6 78520 2007-07-25 2007-07-25 JBL Credit Facility \n",
440 "7 91869 2007-09-17 2007-09-17 AYE Credit Facility \n",
441 "8 93042 2007-09-18 2007-09-18 AIV Credit Facility \n",
442 "9 140305 2007-10-04 2007-10-04 NTRI Credit Facility \n",
443 "10 138791 2007-11-07 2007-11-07 WTI Credit Facility \n",
444 "\n",
445 " event_headline credit_amount \\\n",
446 "0 Copano Energy Completes Amendment of $200M Cre... 200 \n",
447 "1 Navistar International Raises Credit Facility ... 200 \n",
448 "2 Sigma-Aldrich Announces New European Credit Fa... 200 \n",
449 "3 Leggett & Platt Increases Multi-Currency Credi... 200 \n",
450 "4 Applera Signs $200M Credit Agreement 200 \n",
451 "5 Navistar International Unit Gets $200M Credit ... 200 \n",
452 "6 Jabil Increases Credit Facility to $1B 200 \n",
453 "7 Allegheny Increases Credit Facility to $400M 200 \n",
454 "8 AIMCO Increases Credit Facility by $200M 200 \n",
455 "9 Nutri/System Establishes $200M Credit Facility 200 \n",
456 "10 W&T Expands Credit Facility by $200M to $500M 200 \n",
457 "\n",
458 " credit_units event_rating timestamp sid \n",
459 "0 $M 1 2007-01-17 26783 \n",
460 "1 $M 1 2007-01-23 5199 \n",
461 "2 $M 1 2007-03-14 6872 \n",
462 "3 $M 1 2007-05-05 4415 \n",
463 "4 $M 1 2007-06-01 25270 \n",
464 "5 $M 1 2007-06-16 5199 \n",
465 "6 $M 1 2007-07-26 8831 \n",
466 "7 $M 1 2007-09-18 17618 \n",
467 "8 $M 1 2007-09-19 11598 \n",
468 "9 $M 1 2007-10-05 21697 \n",
469 "..."
470 ]
471 },
472 "execution_count": 7,
473 "metadata": {},
474 "output_type": "execute_result"
475 }
476 ],
477 "source": [
478 "twohundreds = credit_facility[(credit_facility.credit_amount==200) & (credit_facility.credit_units==\"$M\")]\n",
479 "# When displaying a Blaze Data Object, the printout is automatically truncated to ten rows.\n",
480 "twohundreds.sort('timestamp')"
481 ]
482 },
483 {
484 "cell_type": "markdown",
485 "metadata": {},
486 "source": [
487 "Finally, suppose we want a DataFrame of that data, but we only want the symbol, timestamp, and event headline:"
488 ]
489 },
490 {
491 "cell_type": "code",
492 "execution_count": 8,
493 "metadata": {
494 "collapsed": false
495 },
496 "outputs": [
497 {
498 "data": {
499 "text/html": [
500 "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
501 "<table border=\"1\" class=\"dataframe\">\n",
502 " <thead>\n",
503 " <tr style=\"text-align: right;\">\n",
504 " <th></th>\n",
505 " <th>symbol</th>\n",
506 " <th>event_headline</th>\n",
507 " <th>timestamp</th>\n",
508 " </tr>\n",
509 " </thead>\n",
510 " <tbody>\n",
511 " <tr>\n",
512 " <th>0</th>\n",
513 " <td>CPNO</td>\n",
514 " <td>Copano Energy Completes Amendment of $200M Cre...</td>\n",
515 " <td>2007-01-17 00:00:00</td>\n",
516 " </tr>\n",
517 " <tr>\n",
518 " <th>1</th>\n",
519 " <td>NAV</td>\n",
520 " <td>Navistar International Raises Credit Facility ...</td>\n",
521 " <td>2007-01-23 00:00:00</td>\n",
522 " </tr>\n",
523 " <tr>\n",
524 " <th>2</th>\n",
525 " <td>SIAL</td>\n",
526 " <td>Sigma-Aldrich Announces New European Credit Fa...</td>\n",
527 " <td>2007-03-14 00:00:00</td>\n",
528 " </tr>\n",
529 " <tr>\n",
530 " <th>3</th>\n",
531 " <td>LEG</td>\n",
532 " <td>Leggett & Platt Increases Multi-Currency Credi...</td>\n",
533 " <td>2007-05-05 00:00:00</td>\n",
534 " </tr>\n",
535 " <tr>\n",
536 " <th>4</th>\n",
537 " <td>ABI</td>\n",
538 " <td>Applera Signs $200M Credit Agreement</td>\n",
539 " <td>2007-06-01 00:00:00</td>\n",
540 " </tr>\n",
541 " <tr>\n",
542 " <th>5</th>\n",
543 " <td>NAV</td>\n",
544 " <td>Navistar International Unit Gets $200M Credit ...</td>\n",
545 " <td>2007-06-16 00:00:00</td>\n",
546 " </tr>\n",
547 " <tr>\n",
548 " <th>6</th>\n",
549 " <td>JBL</td>\n",
550 " <td>Jabil Increases Credit Facility to $1B</td>\n",
551 " <td>2007-07-26 00:00:00</td>\n",
552 " </tr>\n",
553 " <tr>\n",
554 " <th>7</th>\n",
555 " <td>AYE</td>\n",
556 " <td>Allegheny Increases Credit Facility to $400M</td>\n",
557 " <td>2007-09-18 00:00:00</td>\n",
558 " </tr>\n",
559 " <tr>\n",
560 " <th>8</th>\n",
561 " <td>AIV</td>\n",
562 " <td>AIMCO Increases Credit Facility by $200M</td>\n",
563 " <td>2007-09-19 00:00:00</td>\n",
564 " </tr>\n",
565 " <tr>\n",
566 " <th>9</th>\n",
567 " <td>NTRI</td>\n",
568 " <td>Nutri/System Establishes $200M Credit Facility</td>\n",
569 " <td>2007-10-05 00:00:00</td>\n",
570 " </tr>\n",
571 " <tr>\n",
572 " <th>10</th>\n",
573 " <td>WTI</td>\n",
574 " <td>W&T Expands Credit Facility by $200M to $500M</td>\n",
575 " <td>2007-11-08 00:00:00</td>\n",
576 " </tr>\n",
577 " <tr>\n",
578 " <th>11</th>\n",
579 " <td>PAA</td>\n",
580 " <td>Plains All American Raises Credit Facility to ...</td>\n",
581 " <td>2007-11-21 00:00:00</td>\n",
582 " </tr>\n",
583 " <tr>\n",
584 " <th>12</th>\n",
585 " <td>WLFC</td>\n",
586 " <td>Willis Lease Unit Gets $200M Credit Facility</td>\n",
587 " <td>2007-12-14 00:00:00</td>\n",
588 " </tr>\n",
589 " <tr>\n",
590 " <th>13</th>\n",
591 " <td>CBR</td>\n",
592 " <td>Ciber Gets $200M Credit Facility</td>\n",
593 " <td>2008-02-14 00:00:00</td>\n",
594 " </tr>\n",
595 " <tr>\n",
596 " <th>14</th>\n",
597 " <td>BHMC</td>\n",
598 " <td>BHMC Gets $200M Revolving Credit Facility</td>\n",
599 " <td>2008-03-04 00:00:00</td>\n",
600 " </tr>\n",
601 " <tr>\n",
602 " <th>15</th>\n",
603 " <td>LABL</td>\n",
604 " <td>Multi-Color Gets New $200M Credit Facility</td>\n",
605 " <td>2008-03-07 00:00:00</td>\n",
606 " </tr>\n",
607 " <tr>\n",
608 " <th>16</th>\n",
609 " <td>HXM</td>\n",
610 " <td>Homex Signs $200M Credit Facility</td>\n",
611 " <td>2008-07-03 00:00:00</td>\n",
612 " </tr>\n",
613 " <tr>\n",
614 " <th>17</th>\n",
615 " <td>IMH</td>\n",
616 " <td>Impac Mortgage Restructures Credit Facility Wi...</td>\n",
617 " <td>2008-07-04 00:00:00</td>\n",
618 " </tr>\n",
619 " <tr>\n",
620 " <th>18</th>\n",
621 " <td>CCRN</td>\n",
622 " <td>Cross Country Gets $200M Credit Commitment fro...</td>\n",
623 " <td>2008-07-23 00:00:00</td>\n",
624 " </tr>\n",
625 " <tr>\n",
626 " <th>19</th>\n",
627 " <td>AVA</td>\n",
628 " <td>Avista Corp. Closes $200M Line of Credit</td>\n",
629 " <td>2008-12-02 00:00:00</td>\n",
630 " </tr>\n",
631 " <tr>\n",
632 " <th>20</th>\n",
633 " <td>TAXI</td>\n",
634 " <td>Medallion Financial Gets $200M Credit Facility</td>\n",
635 " <td>2008-12-17 00:00:00</td>\n",
636 " </tr>\n",
637 " <tr>\n",
638 " <th>21</th>\n",
639 " <td>TLB</td>\n",
640 " <td>Talbots Gets $200M Term Loan Facility</td>\n",
641 " <td>2009-02-06 00:00:00</td>\n",
642 " </tr>\n",
643 " <tr>\n",
644 " <th>22</th>\n",
645 " <td>FL</td>\n",
646 " <td>Foot Locker Gets $200M Credit Facility</td>\n",
647 " <td>2009-03-25 00:00:00</td>\n",
648 " </tr>\n",
649 " <tr>\n",
650 " <th>23</th>\n",
651 " <td>IR</td>\n",
652 " <td>Ingersoll Rand Gets Additional $200M Credit Fa...</td>\n",
653 " <td>2009-03-31 00:00:00</td>\n",
654 " </tr>\n",
655 " <tr>\n",
656 " <th>24</th>\n",
657 " <td>ROSE</td>\n",
658 " <td>Rosetta Resources Expands and Extends Credit F...</td>\n",
659 " <td>2009-04-10 00:00:00</td>\n",
660 " </tr>\n",
661 " <tr>\n",
662 " <th>25</th>\n",
663 " <td>WLL</td>\n",
664 " <td>Whiting Petroleum Increases Credit Facility by...</td>\n",
665 " <td>2009-04-29 00:00:00</td>\n",
666 " </tr>\n",
667 " <tr>\n",
668 " <th>26</th>\n",
669 " <td>GLAD</td>\n",
670 " <td>Gladstone Capital Gets $200M Credit Facility</td>\n",
671 " <td>2009-05-19 00:00:00</td>\n",
672 " </tr>\n",
673 " <tr>\n",
674 " <th>27</th>\n",
675 " <td>FCH</td>\n",
676 " <td>FelCor's Unit Gets $200M Credit Facility</td>\n",
677 " <td>2009-06-16 00:00:00</td>\n",
678 " </tr>\n",
679 " <tr>\n",
680 " <th>28</th>\n",
681 " <td>PHM</td>\n",
682 " <td>Pulte Homes Gets $200M Credit Facility</td>\n",
683 " <td>2009-06-27 00:00:00</td>\n",
684 " </tr>\n",
685 " <tr>\n",
686 " <th>29</th>\n",
687 " <td>OHI</td>\n",
688 " <td>Omega Gets $200M Credit Facility</td>\n",
689 " <td>2009-07-03 00:00:00</td>\n",
690 " </tr>\n",
691 " <tr>\n",
692 " <th>...</th>\n",
693 " <td>...</td>\n",
694 " <td>...</td>\n",
695 " <td>...</td>\n",
696 " </tr>\n",
697 " <tr>\n",
698 " <th>228</th>\n",
699 " <td>CLNY</td>\n",
700 " <td>Colony Financial Raises Credit Facility to $620M</td>\n",
701 " <td>2014-12-17 00:00:00</td>\n",
702 " </tr>\n",
703 " <tr>\n",
704 " <th>229</th>\n",
705 " <td>STX</td>\n",
706 " <td>Seagate Technology Unit Raises Borrowing Capac...</td>\n",
707 " <td>2015-01-16 00:00:00</td>\n",
708 " </tr>\n",
709 " <tr>\n",
710 " <th>230</th>\n",
711 " <td>MORE</td>\n",
712 " <td>Monogram Residential Trust Gets $200M Credit F...</td>\n",
713 " <td>2015-01-21 00:00:00</td>\n",
714 " </tr>\n",
715 " <tr>\n",
716 " <th>231</th>\n",
717 " <td>GPT</td>\n",
718 " <td>Gramercy Property Trust Raises Revolving Borro...</td>\n",
719 " <td>2015-01-27 00:00:00</td>\n",
720 " </tr>\n",
721 " <tr>\n",
722 " <th>232</th>\n",
723 " <td>PKD</td>\n",
724 " <td>Parker Drilling Co. Gets $200M Revolving Credi...</td>\n",
725 " <td>2015-01-29 00:00:00</td>\n",
726 " </tr>\n",
727 " <tr>\n",
728 " <th>233</th>\n",
729 " <td>PKY</td>\n",
730 " <td>Parkway Properties Amends & Raises Credit Faci...</td>\n",
731 " <td>2015-02-03 00:00:00</td>\n",
732 " </tr>\n",
733 " <tr>\n",
734 " <th>234</th>\n",
735 " <td>HEES</td>\n",
736 " <td>H&E Equipment Services Raises Credit Facility ...</td>\n",
737 " <td>2015-02-10 00:00:00</td>\n",
738 " </tr>\n",
739 " <tr>\n",
740 " <th>235</th>\n",
741 " <td>AHH</td>\n",
742 " <td>Armada Hoffler Properties Gets New $200M Unsec...</td>\n",
743 " <td>2015-02-26 00:00:00</td>\n",
744 " </tr>\n",
745 " <tr>\n",
746 " <th>236</th>\n",
747 " <td>WRI</td>\n",
748 " <td>Weingarten Realty Investors Gets $200M Term Loan</td>\n",
749 " <td>2015-03-03 00:00:00</td>\n",
750 " </tr>\n",
751 " <tr>\n",
752 " <th>237</th>\n",
753 " <td>KND</td>\n",
754 " <td>Kindred Healthcare Closes $200M Incremental Te...</td>\n",
755 " <td>2015-03-11 00:00:00</td>\n",
756 " </tr>\n",
757 " <tr>\n",
758 " <th>238</th>\n",
759 " <td>VRSN</td>\n",
760 " <td>VeriSign Gets $200M Credit Facility</td>\n",
761 " <td>2015-04-02 00:00:00</td>\n",
762 " </tr>\n",
763 " <tr>\n",
764 " <th>239</th>\n",
765 " <td>PSA</td>\n",
766 " <td>Public Storage Raises Credit Facility to $500M</td>\n",
767 " <td>2015-04-03 00:00:00</td>\n",
768 " </tr>\n",
769 " <tr>\n",
770 " <th>240</th>\n",
771 " <td>IBP</td>\n",
772 " <td>Installed Building Products Gets $200M Credit ...</td>\n",
773 " <td>2015-04-30 00:00:00</td>\n",
774 " </tr>\n",
775 " <tr>\n",
776 " <th>241</th>\n",
777 " <td>HEP</td>\n",
778 " <td>Holly Energy Partners Unit Amends & Raises Cre...</td>\n",
779 " <td>2015-05-01 00:00:00</td>\n",
780 " </tr>\n",
781 " <tr>\n",
782 " <th>242</th>\n",
783 " <td>RGLD</td>\n",
784 " <td>Royal Gold Amends & Raises Credit Facility to ...</td>\n",
785 " <td>2015-05-01 00:00:00</td>\n",
786 " </tr>\n",
787 " <tr>\n",
788 " <th>243</th>\n",
789 " <td>PERY</td>\n",
790 " <td>Perry Ellis International Raises Credit Facili...</td>\n",
791 " <td>2015-05-07 00:00:00</td>\n",
792 " </tr>\n",
793 " <tr>\n",
794 " <th>244</th>\n",
795 " <td>CHS</td>\n",
796 " <td>Chicoâs FAS Gets $200M Credit Facility</td>\n",
797 " <td>2015-05-09 00:00:00</td>\n",
798 " </tr>\n",
799 " <tr>\n",
800 " <th>245</th>\n",
801 " <td>PKY</td>\n",
802 " <td>Parkway Properties Gets $200M Unsecured Term Loan</td>\n",
803 " <td>2015-06-30 00:00:00</td>\n",
804 " </tr>\n",
805 " <tr>\n",
806 " <th>246</th>\n",
807 " <td>GST</td>\n",
808 " <td>Gastar Exploration Maintains Borrowing Base Un...</td>\n",
809 " <td>2015-09-01 00:00:00</td>\n",
810 " </tr>\n",
811 " <tr>\n",
812 " <th>247</th>\n",
813 " <td>IART</td>\n",
814 " <td>Integra LifeSciences Holdings Corp. Raises Cre...</td>\n",
815 " <td>2015-09-02 00:00:00</td>\n",
816 " </tr>\n",
817 " <tr>\n",
818 " <th>248</th>\n",
819 " <td>BID</td>\n",
820 " <td>Sotheby's Increases Credit Facility Temporaril...</td>\n",
821 " <td>2015-09-17 00:00:00</td>\n",
822 " </tr>\n",
823 " <tr>\n",
824 " <th>249</th>\n",
825 " <td>BHMC</td>\n",
826 " <td>BHMC Gets $200M Revolving Credit Facility</td>\n",
827 " <td>2015-09-29 11:04:20.713305</td>\n",
828 " </tr>\n",
829 " <tr>\n",
830 " <th>250</th>\n",
831 " <td>DBRN</td>\n",
832 " <td>Dress Barn Gets $200M Credit Facility</td>\n",
833 " <td>2015-09-29 11:04:20.713305</td>\n",
834 " </tr>\n",
835 " <tr>\n",
836 " <th>251</th>\n",
837 " <td>SOLR</td>\n",
838 " <td>GT Solar Gets $200M Credit Facility</td>\n",
839 " <td>2015-09-29 11:04:20.713305</td>\n",
840 " </tr>\n",
841 " <tr>\n",
842 " <th>252</th>\n",
843 " <td>SOLR</td>\n",
844 " <td>GT Solar Gets $200M Credit Facility</td>\n",
845 " <td>2015-09-29 11:04:20.713305</td>\n",
846 " </tr>\n",
847 " <tr>\n",
848 " <th>253</th>\n",
849 " <td>WACC</td>\n",
850 " <td>WCA Waste Gets $200M Revolving Credit Facility</td>\n",
851 " <td>2015-09-29 11:04:20.713305</td>\n",
852 " </tr>\n",
853 " <tr>\n",
854 " <th>254</th>\n",
855 " <td>YSI</td>\n",
856 " <td>U-Store-It Gets $200M Term Loans</td>\n",
857 " <td>2015-09-29 11:04:20.713305</td>\n",
858 " </tr>\n",
859 " <tr>\n",
860 " <th>255</th>\n",
861 " <td>TVL</td>\n",
862 " <td>LIN Television Gets $200M New Credit Facility</td>\n",
863 " <td>2015-09-29 11:04:20.713305</td>\n",
864 " </tr>\n",
865 " <tr>\n",
866 " <th>256</th>\n",
867 " <td>GY</td>\n",
868 " <td>GenCorp Amends and Restates $200M Credit Facility</td>\n",
869 " <td>2015-09-29 11:04:20.713305</td>\n",
870 " </tr>\n",
871 " <tr>\n",
872 " <th>257</th>\n",
873 " <td>WFR</td>\n",
874 " <td>MEMC Electronic Materials Gets $200M Credit Fa...</td>\n",
875 " <td>2015-09-29 11:04:20.713305</td>\n",
876 " </tr>\n",
877 " </tbody>\n",
878 "</table>\n",
879 "<p>258 rows × 3 columns</p>\n",
880 "</div>"
881 ],
882 "text/plain": [
883 " symbol event_headline \\\n",
884 "0 CPNO Copano Energy Completes Amendment of $200M Cre... \n",
885 "1 NAV Navistar International Raises Credit Facility ... \n",
886 "2 SIAL Sigma-Aldrich Announces New European Credit Fa... \n",
887 "3 LEG Leggett & Platt Increases Multi-Currency Credi... \n",
888 "4 ABI Applera Signs $200M Credit Agreement \n",
889 "5 NAV Navistar International Unit Gets $200M Credit ... \n",
890 "6 JBL Jabil Increases Credit Facility to $1B \n",
891 "7 AYE Allegheny Increases Credit Facility to $400M \n",
892 "8 AIV AIMCO Increases Credit Facility by $200M \n",
893 "9 NTRI Nutri/System Establishes $200M Credit Facility \n",
894 "10 WTI W&T Expands Credit Facility by $200M to $500M \n",
895 "11 PAA Plains All American Raises Credit Facility to ... \n",
896 "12 WLFC Willis Lease Unit Gets $200M Credit Facility \n",
897 "13 CBR Ciber Gets $200M Credit Facility \n",
898 "14 BHMC BHMC Gets $200M Revolving Credit Facility \n",
899 "15 LABL Multi-Color Gets New $200M Credit Facility \n",
900 "16 HXM Homex Signs $200M Credit Facility \n",
901 "17 IMH Impac Mortgage Restructures Credit Facility Wi... \n",
902 "18 CCRN Cross Country Gets $200M Credit Commitment fro... \n",
903 "19 AVA Avista Corp. Closes $200M Line of Credit \n",
904 "20 TAXI Medallion Financial Gets $200M Credit Facility \n",
905 "21 TLB Talbots Gets $200M Term Loan Facility \n",
906 "22 FL Foot Locker Gets $200M Credit Facility \n",
907 "23 IR Ingersoll Rand Gets Additional $200M Credit Fa... \n",
908 "24 ROSE Rosetta Resources Expands and Extends Credit F... \n",
909 "25 WLL Whiting Petroleum Increases Credit Facility by... \n",
910 "26 GLAD Gladstone Capital Gets $200M Credit Facility \n",
911 "27 FCH FelCor's Unit Gets $200M Credit Facility \n",
912 "28 PHM Pulte Homes Gets $200M Credit Facility \n",
913 "29 OHI Omega Gets $200M Credit Facility \n",
914 ".. ... ... \n",
915 "228 CLNY Colony Financial Raises Credit Facility to $620M \n",
916 "229 STX Seagate Technology Unit Raises Borrowing Capac... \n",
917 "230 MORE Monogram Residential Trust Gets $200M Credit F... \n",
918 "231 GPT Gramercy Property Trust Raises Revolving Borro... \n",
919 "232 PKD Parker Drilling Co. Gets $200M Revolving Credi... \n",
920 "233 PKY Parkway Properties Amends & Raises Credit Faci... \n",
921 "234 HEES H&E Equipment Services Raises Credit Facility ... \n",
922 "235 AHH Armada Hoffler Properties Gets New $200M Unsec... \n",
923 "236 WRI Weingarten Realty Investors Gets $200M Term Loan \n",
924 "237 KND Kindred Healthcare Closes $200M Incremental Te... \n",
925 "238 VRSN VeriSign Gets $200M Credit Facility \n",
926 "239 PSA Public Storage Raises Credit Facility to $500M \n",
927 "240 IBP Installed Building Products Gets $200M Credit ... \n",
928 "241 HEP Holly Energy Partners Unit Amends & Raises Cre... \n",
929 "242 RGLD Royal Gold Amends & Raises Credit Facility to ... \n",
930 "243 PERY Perry Ellis International Raises Credit Facili... \n",
931 "244 CHS Chico???s FAS Gets $200M Credit Facility \n",
932 "245 PKY Parkway Properties Gets $200M Unsecured Term Loan \n",
933 "246 GST Gastar Exploration Maintains Borrowing Base Un... \n",
934 "247 IART Integra LifeSciences Holdings Corp. Raises Cre... \n",
935 "248 BID Sotheby's Increases Credit Facility Temporaril... \n",
936 "249 BHMC BHMC Gets $200M Revolving Credit Facility \n",
937 "250 DBRN Dress Barn Gets $200M Credit Facility \n",
938 "251 SOLR GT Solar Gets $200M Credit Facility \n",
939 "252 SOLR GT Solar Gets $200M Credit Facility \n",
940 "253 WACC WCA Waste Gets $200M Revolving Credit Facility \n",
941 "254 YSI U-Store-It Gets $200M Term Loans \n",
942 "255 TVL LIN Television Gets $200M New Credit Facility \n",
943 "256 GY GenCorp Amends and Restates $200M Credit Facility \n",
944 "257 WFR MEMC Electronic Materials Gets $200M Credit Fa... \n",
945 "\n",
946 " timestamp \n",
947 "0 2007-01-17 00:00:00 \n",
948 "1 2007-01-23 00:00:00 \n",
949 "2 2007-03-14 00:00:00 \n",
950 "3 2007-05-05 00:00:00 \n",
951 "4 2007-06-01 00:00:00 \n",
952 "5 2007-06-16 00:00:00 \n",
953 "6 2007-07-26 00:00:00 \n",
954 "7 2007-09-18 00:00:00 \n",
955 "8 2007-09-19 00:00:00 \n",
956 "9 2007-10-05 00:00:00 \n",
957 "10 2007-11-08 00:00:00 \n",
958 "11 2007-11-21 00:00:00 \n",
959 "12 2007-12-14 00:00:00 \n",
960 "13 2008-02-14 00:00:00 \n",
961 "14 2008-03-04 00:00:00 \n",
962 "15 2008-03-07 00:00:00 \n",
963 "16 2008-07-03 00:00:00 \n",
964 "17 2008-07-04 00:00:00 \n",
965 "18 2008-07-23 00:00:00 \n",
966 "19 2008-12-02 00:00:00 \n",
967 "20 2008-12-17 00:00:00 \n",
968 "21 2009-02-06 00:00:00 \n",
969 "22 2009-03-25 00:00:00 \n",
970 "23 2009-03-31 00:00:00 \n",
971 "24 2009-04-10 00:00:00 \n",
972 "25 2009-04-29 00:00:00 \n",
973 "26 2009-05-19 00:00:00 \n",
974 "27 2009-06-16 00:00:00 \n",
975 "28 2009-06-27 00:00:00 \n",
976 "29 2009-07-03 00:00:00 \n",
977 ".. ... \n",
978 "228 2014-12-17 00:00:00 \n",
979 "229 2015-01-16 00:00:00 \n",
980 "230 2015-01-21 00:00:00 \n",
981 "231 2015-01-27 00:00:00 \n",
982 "232 2015-01-29 00:00:00 \n",
983 "233 2015-02-03 00:00:00 \n",
984 "234 2015-02-10 00:00:00 \n",
985 "235 2015-02-26 00:00:00 \n",
986 "236 2015-03-03 00:00:00 \n",
987 "237 2015-03-11 00:00:00 \n",
988 "238 2015-04-02 00:00:00 \n",
989 "239 2015-04-03 00:00:00 \n",
990 "240 2015-04-30 00:00:00 \n",
991 "241 2015-05-01 00:00:00 \n",
992 "242 2015-05-01 00:00:00 \n",
993 "243 2015-05-07 00:00:00 \n",
994 "244 2015-05-09 00:00:00 \n",
995 "245 2015-06-30 00:00:00 \n",
996 "246 2015-09-01 00:00:00 \n",
997 "247 2015-09-02 00:00:00 \n",
998 "248 2015-09-17 00:00:00 \n",
999 "249 2015-09-29 11:04:20.713305 \n",
1000 "250 2015-09-29 11:04:20.713305 \n",
1001 "251 2015-09-29 11:04:20.713305 \n",
1002 "252 2015-09-29 11:04:20.713305 \n",
1003 "253 2015-09-29 11:04:20.713305 \n",
1004 "254 2015-09-29 11:04:20.713305 \n",
1005 "255 2015-09-29 11:04:20.713305 \n",
1006 "256 2015-09-29 11:04:20.713305 \n",
1007 "257 2015-09-29 11:04:20.713305 \n",
1008 "\n",
1009 "[258 rows x 3 columns]"
1010 ]
1011 },
1012 "execution_count": 8,
1013 "metadata": {},
1014 "output_type": "execute_result"
1015 }
1016 ],
1017 "source": [
1018 "twohundred_df = odo(twohundreds, pd.DataFrame)\n",
1019 "reduced = twohundred_df[['symbol','event_headline','timestamp']]\n",
1020 "# When printed: pandas DataFrames display the head(30) and tail(30) rows, and truncate the middle.\n",
1021 "reduced"
1022 ]
1023 },
1024 {
1025 "cell_type": "code",
1026 "execution_count": null,
1027 "metadata": {
1028 "collapsed": true
1029 },
1030 "outputs": [],
1031 "source": []
1032 }
1033 ],
1034 "metadata": {
1035 "kernelspec": {
1036 "display_name": "Python 2",
1037 "language": "python",
1038 "name": "python2"
1039 },
1040 "language_info": {
1041 "codemirror_mode": {
1042 "name": "ipython",
1043 "version": 2
1044 },
1045 "file_extension": ".py",
1046 "mimetype": "text/x-python",
1047 "name": "python",
1048 "nbconvert_exporter": "python",
1049 "pygments_lexer": "ipython2",
1050 "version": "2.7.10"
1051 }
1052 },
1053 "nbformat": 4,
1054 "nbformat_minor": 0
1055 }