ml-finance-python
python scripts for finance machine learning
git clone https://9o.is/git/ml-finance-python.git
notebook.ipynb
(23586B)
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {
6 "collapsed": true
7 },
8 "source": [
9 "# EventVestor: CEO Changes\n",
10 "\n",
11 "In this notebook, we'll take a look at EventVestor's *CEO Changes* dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans January 01, 2007 through the current day.\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 ceo_change\n",
47 "# or if you want to import the free dataset, use:\n",
48 "# from quantopian.data.eventvestor import ceo_change_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 " change_status: ?string,\n",
74 " change_scenario: ?string,\n",
75 " change_type: ?string,\n",
76 " change_source: ?string,\n",
77 " change_reason: ?string,\n",
78 " in_ceoname: ?string,\n",
79 " in_ceogender: ?string,\n",
80 " out_ceoname: ?string,\n",
81 " out_ceogender: ?string,\n",
82 " effective_date: ?datetime,\n",
83 " event_rating: ?float64,\n",
84 " timestamp: datetime,\n",
85 " sid: ?int64\n",
86 " }\"\"\")"
87 ]
88 },
89 "execution_count": 4,
90 "metadata": {},
91 "output_type": "execute_result"
92 }
93 ],
94 "source": [
95 "# Let's use blaze to understand the data a bit using Blaze dshape()\n",
96 "ceo_change.dshape"
97 ]
98 },
99 {
100 "cell_type": "code",
101 "execution_count": 5,
102 "metadata": {
103 "collapsed": false
104 },
105 "outputs": [
106 {
107 "data": {
108 "text/html": [
109 "4324"
110 ],
111 "text/plain": [
112 "4324"
113 ]
114 },
115 "execution_count": 5,
116 "metadata": {},
117 "output_type": "execute_result"
118 }
119 ],
120 "source": [
121 "# And how many rows are there?\n",
122 "# N.B. we're using a Blaze function to do this, not len()\n",
123 "ceo_change.count()"
124 ]
125 },
126 {
127 "cell_type": "code",
128 "execution_count": 6,
129 "metadata": {
130 "collapsed": false
131 },
132 "outputs": [
133 {
134 "data": {
135 "text/html": [
136 "<table border=\"1\" class=\"dataframe\">\n",
137 " <thead>\n",
138 " <tr style=\"text-align: right;\">\n",
139 " <th></th>\n",
140 " <th>event_id</th>\n",
141 " <th>asof_date</th>\n",
142 " <th>trade_date</th>\n",
143 " <th>symbol</th>\n",
144 " <th>event_type</th>\n",
145 " <th>event_headline</th>\n",
146 " <th>change_status</th>\n",
147 " <th>change_scenario</th>\n",
148 " <th>change_type</th>\n",
149 " <th>change_source</th>\n",
150 " <th>change_reason</th>\n",
151 " <th>in_ceoname</th>\n",
152 " <th>in_ceogender</th>\n",
153 " <th>out_ceoname</th>\n",
154 " <th>out_ceogender</th>\n",
155 " <th>effective_date</th>\n",
156 " <th>event_rating</th>\n",
157 " <th>timestamp</th>\n",
158 " <th>sid</th>\n",
159 " </tr>\n",
160 " </thead>\n",
161 " <tbody>\n",
162 " <tr>\n",
163 " <th>0</th>\n",
164 " <td>134628</td>\n",
165 " <td>2007-01-03</td>\n",
166 " <td>2007-01-03</td>\n",
167 " <td>HD</td>\n",
168 " <td>CEO Change</td>\n",
169 " <td>Home Depot CEO Steps Down</td>\n",
170 " <td>Declaration</td>\n",
171 " <td>In/Out</td>\n",
172 " <td>Permanent</td>\n",
173 " <td>Succession</td>\n",
174 " <td>Resign</td>\n",
175 " <td>Frank Blake,</td>\n",
176 " <td>Male</td>\n",
177 " <td>Robert Nardelli</td>\n",
178 " <td>Male</td>\n",
179 " <td>2007-01-02</td>\n",
180 " <td>1</td>\n",
181 " <td>2007-01-04</td>\n",
182 " <td>3496</td>\n",
183 " </tr>\n",
184 " <tr>\n",
185 " <th>1</th>\n",
186 " <td>1133605</td>\n",
187 " <td>2007-01-04</td>\n",
188 " <td>2007-01-04</td>\n",
189 " <td>RAIL</td>\n",
190 " <td>CEO Change</td>\n",
191 " <td>FreightCar America CEO John E. Carroll to Reti...</td>\n",
192 " <td>Proposal</td>\n",
193 " <td>In/Out</td>\n",
194 " <td>Permanent</td>\n",
195 " <td>Outsider</td>\n",
196 " <td>Resign</td>\n",
197 " <td>Christian Ragot</td>\n",
198 " <td>Male</td>\n",
199 " <td>John E. Carroll, Jr.</td>\n",
200 " <td>Male</td>\n",
201 " <td>2007-04-30</td>\n",
202 " <td>1</td>\n",
203 " <td>2007-01-05</td>\n",
204 " <td>27161</td>\n",
205 " </tr>\n",
206 " <tr>\n",
207 " <th>2</th>\n",
208 " <td>950064</td>\n",
209 " <td>2007-01-04</td>\n",
210 " <td>2007-01-04</td>\n",
211 " <td>VIRL</td>\n",
212 " <td>CEO Change</td>\n",
213 " <td>Virage Logic CEO Adam Kablanian Resigns; Appoi...</td>\n",
214 " <td>Declaration</td>\n",
215 " <td>In/Out</td>\n",
216 " <td>Permanent</td>\n",
217 " <td>Succession</td>\n",
218 " <td>Out + Retained</td>\n",
219 " <td>Dan McCranie</td>\n",
220 " <td>Male</td>\n",
221 " <td>Adam Kablanian</td>\n",
222 " <td>Male</td>\n",
223 " <td>2007-01-04</td>\n",
224 " <td>1</td>\n",
225 " <td>2007-01-05</td>\n",
226 " <td>21957</td>\n",
227 " </tr>\n",
228 " </tbody>\n",
229 "</table>"
230 ],
231 "text/plain": [
232 " event_id asof_date trade_date symbol event_type \\\n",
233 "0 134628 2007-01-03 2007-01-03 HD CEO Change \n",
234 "1 1133605 2007-01-04 2007-01-04 RAIL CEO Change \n",
235 "2 950064 2007-01-04 2007-01-04 VIRL CEO Change \n",
236 "\n",
237 " event_headline change_status \\\n",
238 "0 Home Depot CEO Steps Down Declaration \n",
239 "1 FreightCar America CEO John E. Carroll to Reti... Proposal \n",
240 "2 Virage Logic CEO Adam Kablanian Resigns; Appoi... Declaration \n",
241 "\n",
242 " change_scenario change_type change_source change_reason in_ceoname \\\n",
243 "0 In/Out Permanent Succession Resign Frank Blake, \n",
244 "1 In/Out Permanent Outsider Resign Christian Ragot \n",
245 "2 In/Out Permanent Succession Out + Retained Dan McCranie \n",
246 "\n",
247 " in_ceogender out_ceoname out_ceogender effective_date \\\n",
248 "0 Male Robert Nardelli Male 2007-01-02 \n",
249 "1 Male John E. Carroll, Jr. Male 2007-04-30 \n",
250 "2 Male Adam Kablanian Male 2007-01-04 \n",
251 "\n",
252 " event_rating timestamp sid \n",
253 "0 1 2007-01-04 3496 \n",
254 "1 1 2007-01-05 27161 \n",
255 "2 1 2007-01-05 21957 "
256 ]
257 },
258 "execution_count": 6,
259 "metadata": {},
260 "output_type": "execute_result"
261 }
262 ],
263 "source": [
264 "# Let's see what the data looks like. We'll grab the first three rows.\n",
265 "ceo_change[:3]"
266 ]
267 },
268 {
269 "cell_type": "markdown",
270 "metadata": {},
271 "source": [
272 "Let's go over the columns:\n",
273 "- **event_id**: the unique identifier for this CEO Change.\n",
274 "- **asof_date**: EventVestor's timestamp of event capture.\n",
275 "- **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",
276 "- **symbol**: stock ticker symbol of the affected company.\n",
277 "- **event_type**: this should always be *CEO Change*.\n",
278 "- **event_headline**: a short description of the event.\n",
279 "- **change_status**: indicates whether the change is a proposal or a confirmation.\n",
280 "- **change_scenario**: indicates if the CEO Change is *in*, *out*, or both.\n",
281 "- **change_type**: indicates if the incoming CEO is interim or permanent.\n",
282 "- **change_source**: is the incoming CEO an internal candidate, or recruited from the outside?\n",
283 "- **change_reason**: reason for the CEO transition\n",
284 "- **in_ceoname**: name of the incoming CEO\n",
285 "- **in_ceoname**: gender of the incoming CEO\n",
286 "- **out_ceoname**: name of the outgoing CEO\n",
287 "- **out_ceogender**: gender of the outgoing CEO\n",
288 "- **effective_date**: date as of which the CEO change is effective.\n",
289 "- **event_rating**: this is always 1. The meaning of this is uncertain.\n",
290 "- **timestamp**: this is our timestamp on when we registered the data.\n",
291 "- **sid**: the equity's unique identifier. Use this instead of the symbol."
292 ]
293 },
294 {
295 "cell_type": "markdown",
296 "metadata": {},
297 "source": [
298 "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",
299 "\n",
300 "We can select columns and rows with ease. Below, we'll fetch all entries for Microsoft. We're really only interested in the CEO coming in, the CEO going out, and the date, so we'll display only those columns."
301 ]
302 },
303 {
304 "cell_type": "code",
305 "execution_count": 7,
306 "metadata": {
307 "collapsed": false
308 },
309 "outputs": [
310 {
311 "data": {
312 "text/plain": [
313 "Equity(5061, symbol=u'MSFT', asset_name=u'MICROSOFT CORP', exchange=u'NASDAQ GLOBAL SELECT MARKET', start_date=u'Mon, 04 Jan 1993 00:00:00 GMT', end_date=u'Tue, 29 Sep 2015 00:00:00 GMT', first_traded=None)"
314 ]
315 },
316 "execution_count": 7,
317 "metadata": {},
318 "output_type": "execute_result"
319 }
320 ],
321 "source": [
322 "# get the sid for MSFT\n",
323 "symbols('MSFT')"
324 ]
325 },
326 {
327 "cell_type": "code",
328 "execution_count": 8,
329 "metadata": {
330 "collapsed": false,
331 "scrolled": false
332 },
333 "outputs": [
334 {
335 "data": {
336 "text/html": [
337 "<table border=\"1\" class=\"dataframe\">\n",
338 " <thead>\n",
339 " <tr style=\"text-align: right;\">\n",
340 " <th></th>\n",
341 " <th>timestamp</th>\n",
342 " <th>in_ceoname</th>\n",
343 " <th>out_ceoname</th>\n",
344 " <th>change_status</th>\n",
345 " </tr>\n",
346 " </thead>\n",
347 " <tbody>\n",
348 " <tr>\n",
349 " <th>0</th>\n",
350 " <td>2013-08-24</td>\n",
351 " <td>NaN</td>\n",
352 " <td>Steve Ballmer</td>\n",
353 " <td>Declaration</td>\n",
354 " </tr>\n",
355 " <tr>\n",
356 " <th>1</th>\n",
357 " <td>2014-02-05</td>\n",
358 " <td>Satya Nadella</td>\n",
359 " <td>NaN</td>\n",
360 " <td>Declaration</td>\n",
361 " </tr>\n",
362 " </tbody>\n",
363 "</table>"
364 ],
365 "text/plain": [
366 " timestamp in_ceoname out_ceoname change_status\n",
367 "0 2013-08-24 NaN Steve Ballmer Declaration\n",
368 "1 2014-02-05 Satya Nadella NaN Declaration"
369 ]
370 },
371 "execution_count": 8,
372 "metadata": {},
373 "output_type": "execute_result"
374 }
375 ],
376 "source": [
377 "# knowing that the MSFT sid is 5061:\n",
378 "msft = ceo_change[ceo_change.sid==5061][['timestamp','in_ceoname', 'out_ceoname','change_status']].sort('timestamp')\n",
379 "msft"
380 ]
381 },
382 {
383 "cell_type": "markdown",
384 "metadata": {},
385 "source": [
386 "Note that the `in_ceoname` and `out_ceoname` in these cases were NaNs because there was a long transition period. Steve Ballmer announced his resignation on 2013-08-24, and formally stepped down on 2014-02-05.\n",
387 "\n",
388 "Let's try another one:"
389 ]
390 },
391 {
392 "cell_type": "code",
393 "execution_count": 9,
394 "metadata": {
395 "collapsed": false
396 },
397 "outputs": [
398 {
399 "data": {
400 "text/html": [
401 "<table border=\"1\" class=\"dataframe\">\n",
402 " <thead>\n",
403 " <tr style=\"text-align: right;\">\n",
404 " <th></th>\n",
405 " <th>timestamp</th>\n",
406 " <th>in_ceoname</th>\n",
407 " <th>out_ceoname</th>\n",
408 " <th>change_status</th>\n",
409 " </tr>\n",
410 " </thead>\n",
411 " <tbody>\n",
412 " <tr>\n",
413 " <th>0</th>\n",
414 " <td>2008-07-18</td>\n",
415 " <td>Dirk Meyer</td>\n",
416 " <td>Hector Ruiz</td>\n",
417 " <td>Declaration</td>\n",
418 " </tr>\n",
419 " <tr>\n",
420 " <th>1</th>\n",
421 " <td>2011-01-11</td>\n",
422 " <td>Thomas Seifert</td>\n",
423 " <td>Dirk Meyer</td>\n",
424 " <td>Declaration</td>\n",
425 " </tr>\n",
426 " <tr>\n",
427 " <th>2</th>\n",
428 " <td>2011-08-26</td>\n",
429 " <td>Rory P. Read</td>\n",
430 " <td>NaN</td>\n",
431 " <td>Declaration</td>\n",
432 " </tr>\n",
433 " <tr>\n",
434 " <th>3</th>\n",
435 " <td>2014-10-09</td>\n",
436 " <td>Lisa Su</td>\n",
437 " <td>Rory Read</td>\n",
438 " <td>Declaration</td>\n",
439 " </tr>\n",
440 " </tbody>\n",
441 "</table>"
442 ],
443 "text/plain": [
444 " timestamp in_ceoname out_ceoname change_status\n",
445 "0 2008-07-18 Dirk Meyer Hector Ruiz Declaration\n",
446 "1 2011-01-11 Thomas Seifert Dirk Meyer Declaration\n",
447 "2 2011-08-26 Rory P. Read NaN Declaration\n",
448 "3 2014-10-09 Lisa Su Rory Read Declaration"
449 ]
450 },
451 "execution_count": 9,
452 "metadata": {},
453 "output_type": "execute_result"
454 }
455 ],
456 "source": [
457 "# get the sid for AMD\n",
458 "sid_amd = symbols('AMD').sid\n",
459 "amd = ceo_change[ceo_change.sid==sid_amd][['timestamp','in_ceoname', 'out_ceoname','change_status']].sort('timestamp')\n",
460 "amd"
461 ]
462 },
463 {
464 "cell_type": "markdown",
465 "metadata": {},
466 "source": [
467 "Now suppose want to know how many CEO changes there were in the past year in which a female CEO was incoming."
468 ]
469 },
470 {
471 "cell_type": "code",
472 "execution_count": 10,
473 "metadata": {
474 "collapsed": false
475 },
476 "outputs": [
477 {
478 "data": {
479 "text/plain": [
480 "27"
481 ]
482 },
483 "execution_count": 10,
484 "metadata": {},
485 "output_type": "execute_result"
486 }
487 ],
488 "source": [
489 "females_in = ceo_change[ceo_change['in_ceogender']=='Female']\n",
490 "# Note that whenever you print a Blaze Data Object here, it will be automatically truncated to ten rows.\n",
491 "females_in = females_in[females_in.asof_date > '2014-09-17']\n",
492 "len(females_in)"
493 ]
494 },
495 {
496 "cell_type": "markdown",
497 "metadata": {},
498 "source": [
499 "Finally, suppose want this as a DataFrame:"
500 ]
501 },
502 {
503 "cell_type": "code",
504 "execution_count": 11,
505 "metadata": {
506 "collapsed": false
507 },
508 "outputs": [
509 {
510 "data": {
511 "text/html": [
512 "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
513 "<table border=\"1\" class=\"dataframe\">\n",
514 " <thead>\n",
515 " <tr style=\"text-align: right;\">\n",
516 " <th></th>\n",
517 " <th>event_id</th>\n",
518 " <th>asof_date</th>\n",
519 " <th>trade_date</th>\n",
520 " <th>symbol</th>\n",
521 " <th>event_type</th>\n",
522 " <th>event_headline</th>\n",
523 " <th>change_status</th>\n",
524 " <th>change_scenario</th>\n",
525 " <th>change_type</th>\n",
526 " <th>change_source</th>\n",
527 " <th>change_reason</th>\n",
528 " <th>in_ceoname</th>\n",
529 " <th>in_ceogender</th>\n",
530 " <th>out_ceoname</th>\n",
531 " <th>out_ceogender</th>\n",
532 " <th>effective_date</th>\n",
533 " <th>event_rating</th>\n",
534 " <th>timestamp</th>\n",
535 " <th>sid</th>\n",
536 " </tr>\n",
537 " </thead>\n",
538 " <tbody>\n",
539 " <tr>\n",
540 " <th>17</th>\n",
541 " <td>1890286</td>\n",
542 " <td>2015-06-01</td>\n",
543 " <td>2015-06-01</td>\n",
544 " <td>AJRD</td>\n",
545 " <td>CEO Change</td>\n",
546 " <td>Aerojet Rocketdynes Holdings CEO Scott Seymour...</td>\n",
547 " <td>Declaration</td>\n",
548 " <td>In/Out</td>\n",
549 " <td>Permanent</td>\n",
550 " <td>Succession</td>\n",
551 " <td>Retire</td>\n",
552 " <td>Eileen Drake</td>\n",
553 " <td>Female</td>\n",
554 " <td>Scott Seymour</td>\n",
555 " <td>Male</td>\n",
556 " <td>NaT</td>\n",
557 " <td>1</td>\n",
558 " <td>2015-06-02</td>\n",
559 " <td>3424</td>\n",
560 " </tr>\n",
561 " <tr>\n",
562 " <th>2</th>\n",
563 " <td>1783327</td>\n",
564 " <td>2014-10-08</td>\n",
565 " <td>2014-10-09</td>\n",
566 " <td>AMD</td>\n",
567 " <td>CEO Change</td>\n",
568 " <td>Advanced Micro Devices CEO Rory Read Steps Dow...</td>\n",
569 " <td>Declaration</td>\n",
570 " <td>In/Out</td>\n",
571 " <td>Permanent</td>\n",
572 " <td>Succession</td>\n",
573 " <td>Out + Retained</td>\n",
574 " <td>Lisa Su</td>\n",
575 " <td>Female</td>\n",
576 " <td>Rory Read</td>\n",
577 " <td>Male</td>\n",
578 " <td>2014-10-08</td>\n",
579 " <td>1</td>\n",
580 " <td>2014-10-09</td>\n",
581 " <td>351</td>\n",
582 " </tr>\n",
583 " <tr>\n",
584 " <th>15</th>\n",
585 " <td>1846426</td>\n",
586 " <td>2015-03-04</td>\n",
587 " <td>2015-03-05</td>\n",
588 " <td>AMSF</td>\n",
589 " <td>CEO Change</td>\n",
590 " <td>AMERISAFE Promotes COO, G. Janelle Frost to CE...</td>\n",
591 " <td>Declaration</td>\n",
592 " <td>In/Out</td>\n",
593 " <td>Permanent</td>\n",
594 " <td>Succession</td>\n",
595 " <td>Out + Retained</td>\n",
596 " <td>G. Janelle Frost</td>\n",
597 " <td>Female</td>\n",
598 " <td>C. Allen Bradley Jr.</td>\n",
599 " <td>Male</td>\n",
600 " <td>2015-04-01</td>\n",
601 " <td>1</td>\n",
602 " <td>2015-03-05</td>\n",
603 " <td>27819</td>\n",
604 " </tr>\n",
605 " </tbody>\n",
606 "</table>\n",
607 "</div>"
608 ],
609 "text/plain": [
610 " event_id asof_date trade_date symbol event_type \\\n",
611 "17 1890286 2015-06-01 2015-06-01 AJRD CEO Change \n",
612 "2 1783327 2014-10-08 2014-10-09 AMD CEO Change \n",
613 "15 1846426 2015-03-04 2015-03-05 AMSF CEO Change \n",
614 "\n",
615 " event_headline change_status \\\n",
616 "17 Aerojet Rocketdynes Holdings CEO Scott Seymour... Declaration \n",
617 "2 Advanced Micro Devices CEO Rory Read Steps Dow... Declaration \n",
618 "15 AMERISAFE Promotes COO, G. Janelle Frost to CE... Declaration \n",
619 "\n",
620 " change_scenario change_type change_source change_reason \\\n",
621 "17 In/Out Permanent Succession Retire \n",
622 "2 In/Out Permanent Succession Out + Retained \n",
623 "15 In/Out Permanent Succession Out + Retained \n",
624 "\n",
625 " in_ceoname in_ceogender out_ceoname out_ceogender \\\n",
626 "17 Eileen Drake Female Scott Seymour Male \n",
627 "2 Lisa Su Female Rory Read Male \n",
628 "15 G. Janelle Frost Female C. Allen Bradley Jr. Male \n",
629 "\n",
630 " effective_date event_rating timestamp sid \n",
631 "17 NaT 1 2015-06-02 3424 \n",
632 "2 2014-10-08 1 2014-10-09 351 \n",
633 "15 2015-04-01 1 2015-03-05 27819 "
634 ]
635 },
636 "execution_count": 11,
637 "metadata": {},
638 "output_type": "execute_result"
639 }
640 ],
641 "source": [
642 "females_in_df = odo(females_in, pd.DataFrame)\n",
643 "females_in_df.sort('symbol', inplace=True)\n",
644 "# let's get the first three rows\n",
645 "females_in_df[:3]"
646 ]
647 },
648 {
649 "cell_type": "code",
650 "execution_count": null,
651 "metadata": {
652 "collapsed": true
653 },
654 "outputs": [],
655 "source": []
656 }
657 ],
658 "metadata": {
659 "kernelspec": {
660 "display_name": "Python 2",
661 "language": "python",
662 "name": "python2"
663 },
664 "language_info": {
665 "codemirror_mode": {
666 "name": "ipython",
667 "version": 2
668 },
669 "file_extension": ".py",
670 "mimetype": "text/x-python",
671 "name": "python",
672 "nbconvert_exporter": "python",
673 "pygments_lexer": "ipython2",
674 "version": "2.7.12"
675 }
676 },
677 "nbformat": 4,
678 "nbformat_minor": 0
679 }