Last active
January 21, 2017 23:10
-
-
Save tarunparmar/8e2ebee37c8e7aaa10fd48acef1e5e52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nfrom pandas import DataFrame, Series\n", | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#def avg_medal_count():\n\ncountries = ['Russian Fed.', 'Norway', 'Canada', 'United States',\n 'Netherlands', 'Germany', 'Switzerland', 'Belarus',\n 'Austria', 'France', 'Poland', 'China', 'Korea', \n 'Sweden', 'Czech Republic', 'Slovenia', 'Japan',\n 'Finland', 'Great Britain', 'Ukraine', 'Slovakia',\n 'Italy', 'Latvia', 'Australia', 'Croatia', 'Kazakhstan','JhumriTalai']\n\ngold = [13, 11, 10, 9, 8, 8, 6, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,0]\nsilver = [11, 5, 10, 7, 7, 6, 3, 0, 8, 4, 1, 4, 3, 7, 4, 2, 4, 3, 1, 0, 0, 2, 2, 2, 1, 0,0]\nbronze = [9, 10, 5, 12, 9, 5, 2, 1, 5, 7, 1, 2, 2, 6, 2, 4, 3, 1, 2, 1, 0, 6, 2, 1, 0, 1,0]\n \nolympic_medal_counts = {'country_name':countries,\n 'gold': Series(gold),\n 'silver': Series(silver),\n 'bronze': Series(bronze)} \ndf = DataFrame(olympic_medal_counts)\n \n # YOUR CODE HERE\n\n#return avg_medal_count", | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "df", | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": " bronze country_name gold silver\n0 9 Russian Fed. 13 11\n1 10 Norway 11 5\n2 5 Canada 10 10\n3 12 United States 9 7\n4 9 Netherlands 8 7\n5 5 Germany 8 6\n6 2 Switzerland 6 3\n7 1 Belarus 5 0\n8 5 Austria 4 8\n9 7 France 4 4\n10 1 Poland 4 1\n11 2 China 3 4\n12 2 Korea 3 3\n13 6 Sweden 2 7\n14 2 Czech Republic 2 4\n15 4 Slovenia 2 2\n16 3 Japan 1 4\n17 1 Finland 1 3\n18 2 Great Britain 1 1\n19 1 Ukraine 1 0\n20 0 Slovakia 1 0\n21 6 Italy 0 2\n22 2 Latvia 0 2\n23 1 Australia 0 2\n24 0 Croatia 0 1\n25 1 Kazakhstan 0 0\n26 0 JhumriTalai 0 0", | |
"text/html": "<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>bronze</th>\n <th>country_name</th>\n <th>gold</th>\n <th>silver</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>9</td>\n <td>Russian Fed.</td>\n <td>13</td>\n <td>11</td>\n </tr>\n <tr>\n <th>1</th>\n <td>10</td>\n <td>Norway</td>\n <td>11</td>\n <td>5</td>\n </tr>\n <tr>\n <th>2</th>\n <td>5</td>\n <td>Canada</td>\n <td>10</td>\n <td>10</td>\n </tr>\n <tr>\n <th>3</th>\n <td>12</td>\n <td>United States</td>\n <td>9</td>\n <td>7</td>\n </tr>\n <tr>\n <th>4</th>\n <td>9</td>\n <td>Netherlands</td>\n <td>8</td>\n <td>7</td>\n </tr>\n <tr>\n <th>5</th>\n <td>5</td>\n <td>Germany</td>\n <td>8</td>\n <td>6</td>\n </tr>\n <tr>\n <th>6</th>\n <td>2</td>\n <td>Switzerland</td>\n <td>6</td>\n <td>3</td>\n </tr>\n <tr>\n <th>7</th>\n <td>1</td>\n <td>Belarus</td>\n <td>5</td>\n <td>0</td>\n </tr>\n <tr>\n <th>8</th>\n <td>5</td>\n <td>Austria</td>\n <td>4</td>\n <td>8</td>\n </tr>\n <tr>\n <th>9</th>\n <td>7</td>\n <td>France</td>\n <td>4</td>\n <td>4</td>\n </tr>\n <tr>\n <th>10</th>\n <td>1</td>\n <td>Poland</td>\n <td>4</td>\n <td>1</td>\n </tr>\n <tr>\n <th>11</th>\n <td>2</td>\n <td>China</td>\n <td>3</td>\n <td>4</td>\n </tr>\n <tr>\n <th>12</th>\n <td>2</td>\n <td>Korea</td>\n <td>3</td>\n <td>3</td>\n </tr>\n <tr>\n <th>13</th>\n <td>6</td>\n <td>Sweden</td>\n <td>2</td>\n <td>7</td>\n </tr>\n <tr>\n <th>14</th>\n <td>2</td>\n <td>Czech Republic</td>\n <td>2</td>\n <td>4</td>\n </tr>\n <tr>\n <th>15</th>\n <td>4</td>\n <td>Slovenia</td>\n <td>2</td>\n <td>2</td>\n </tr>\n <tr>\n <th>16</th>\n <td>3</td>\n <td>Japan</td>\n <td>1</td>\n <td>4</td>\n </tr>\n <tr>\n <th>17</th>\n <td>1</td>\n <td>Finland</td>\n <td>1</td>\n <td>3</td>\n </tr>\n <tr>\n <th>18</th>\n <td>2</td>\n <td>Great Britain</td>\n <td>1</td>\n <td>1</td>\n </tr>\n <tr>\n <th>19</th>\n <td>1</td>\n <td>Ukraine</td>\n <td>1</td>\n <td>0</td>\n </tr>\n <tr>\n <th>20</th>\n <td>0</td>\n <td>Slovakia</td>\n <td>1</td>\n <td>0</td>\n </tr>\n <tr>\n <th>21</th>\n <td>6</td>\n <td>Italy</td>\n <td>0</td>\n <td>2</td>\n </tr>\n <tr>\n <th>22</th>\n <td>2</td>\n <td>Latvia</td>\n <td>0</td>\n <td>2</td>\n </tr>\n <tr>\n <th>23</th>\n <td>1</td>\n <td>Australia</td>\n <td>0</td>\n <td>2</td>\n </tr>\n <tr>\n <th>24</th>\n <td>0</td>\n <td>Croatia</td>\n <td>0</td>\n <td>1</td>\n </tr>\n <tr>\n <th>25</th>\n <td>1</td>\n <td>Kazakhstan</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>26</th>\n <td>0</td>\n <td>JhumriTalai</td>\n <td>0</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
}, | |
"execution_count": 3, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": " #atleast_one_medal = \nnewdf = df[(df['gold'] >=1) | (df['silver'] >=1) | df['bronze']>=1]", | |
"execution_count": 4, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "\navg_medal_count = newdf.mean()\n \n ", | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "avg_medal_count", | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "bronze 3.807692\ngold 3.807692\nsilver 3.730769\ndtype: float64" | |
}, | |
"execution_count": 6, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "df[['gold','silver','bronze']].apply(np.mean)", | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "gold 3.666667\nsilver 3.592593\nbronze 3.666667\ndtype: float64" | |
}, | |
"execution_count": 7, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "olympic_medal_counts = {'country_name':countries,\n 'gold': Series(gold),\n 'silver': Series(silver),\n 'bronze': Series(bronze)} \nolympic_medal_counts_df = DataFrame(olympic_medal_counts)", | |
"execution_count": 8, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "medals = olympic_medal_counts_df[['gold','silver','bronze']]", | |
"execution_count": 9, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "points = np.dot(medals,[4,2,1])", | |
"execution_count": 11, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "olympic_points = {'country_name':Series(countries), 'points':Series(points)}", | |
"execution_count": 12, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "olympic_points_df = DataFrame(olympic_points)", | |
"execution_count": 13, | |
"outputs": [] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Learning scikit-learn" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "from sklearn import svm", | |
"execution_count": 14, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "print('The scikit-learn version is {}.'.format(sklearn.__version__))", | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"ename": "NameError", | |
"traceback": [ | |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", | |
"\u001b[1;32m<ipython-input-16-36d0d3e655ef>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'The scikit-learn version is {}.'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msklearn\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__version__\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |
"\u001b[1;31mNameError\u001b[0m: name 'sklearn' is not defined" | |
], | |
"output_type": "error", | |
"evalue": "name 'sklearn' is not defined" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nX = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])\nY = np.array([1, 1, 1, 2, 2, 2])\nfrom sklearn.naive_bayes import GaussianNB\nclf = GaussianNB()\nclf.fit(X, Y)\n\nprint(clf.predict([[-0.8, -1]]))", | |
"execution_count": 17, | |
"outputs": [ | |
{ | |
"text": "[1]\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nX = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])\nY = np.array([1, 1, 1, 2, 2, 2])\nfrom sklearn.naive_bayes import GaussianNB\nclf = GaussianNB()\nclf.fit(X, Y)\n", | |
"execution_count": 18, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "GaussianNB()" | |
}, | |
"execution_count": 18, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "print(clf.predict([[-0.8, -1]]))", | |
"execution_count": 19, | |
"outputs": [ | |
{ | |
"text": "[1]\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Learning LabelEncoding and One-hot Encoding" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nimport pandas as pd", | |
"execution_count": 20, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "XX = pd.read_csv('titanic_data.csv') ", | |
"execution_count": 21, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "X = XX.select_dtypes(include=[object])", | |
"execution_count": 22, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X.head()", | |
"execution_count": 23, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": " Name Sex \\\n0 Braund, Mr. Owen Harris male \n1 Cumings, Mrs. John Bradley (Florence Briggs Th... female \n2 Heikkinen, Miss. Laina female \n3 Futrelle, Mrs. Jacques Heath (Lily May Peel) female \n4 Allen, Mr. William Henry male \n\n Ticket Cabin Embarked \n0 A/5 21171 NaN S \n1 PC 17599 C85 C \n2 STON/O2. 3101282 NaN S \n3 113803 C123 S \n4 373450 NaN S ", | |
"text/html": "<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Name</th>\n <th>Sex</th>\n <th>Ticket</th>\n <th>Cabin</th>\n <th>Embarked</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Braund, Mr. Owen Harris</td>\n <td>male</td>\n <td>A/5 21171</td>\n <td>NaN</td>\n <td>S</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n <td>female</td>\n <td>PC 17599</td>\n <td>C85</td>\n <td>C</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Heikkinen, Miss. Laina</td>\n <td>female</td>\n <td>STON/O2. 3101282</td>\n <td>NaN</td>\n <td>S</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n <td>female</td>\n <td>113803</td>\n <td>C123</td>\n <td>S</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Allen, Mr. William Henry</td>\n <td>male</td>\n <td>373450</td>\n <td>NaN</td>\n <td>S</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
}, | |
"execution_count": 23, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "from sklearn.preprocessing import LabelEncoder\nfrom sklearn.preprocessing import OneHotEncoder", | |
"execution_count": 24, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "le = LabelEncoder()", | |
"execution_count": 25, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "List = ['Name','Sex','Ticket','Cabin','Embarked']\nfor i in List:\n print (X[i].head())", | |
"execution_count": 26, | |
"outputs": [ | |
{ | |
"text": "0 Braund, Mr. Owen Harris\n1 Cumings, Mrs. John Bradley (Florence Briggs Th...\n2 Heikkinen, Miss. Laina\n3 Futrelle, Mrs. Jacques Heath (Lily May Peel)\n4 Allen, Mr. William Henry\nName: Name, dtype: object\n0 male\n1 female\n2 female\n3 female\n4 male\nName: Sex, dtype: object\n0 A/5 21171\n1 PC 17599\n2 STON/O2. 3101282\n3 113803\n4 373450\nName: Ticket, dtype: object\n0 NaN\n1 C85\n2 NaN\n3 C123\n4 NaN\nName: Cabin, dtype: object\n0 S\n1 C\n2 S\n3 S\n4 S\nName: Embarked, dtype: object\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "X = X.dropna()", | |
"execution_count": 27, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "for i in X:\n #print(X[feat].head())\n X[i] = le.fit_transform(X[i])", | |
"execution_count": 28, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X", | |
"execution_count": 29, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": " Name Sex Ticket Cabin Embarked\n1 51 0 123 80 0\n3 74 0 36 54 2\n6 122 1 62 128 2\n10 161 0 134 144 2\n11 27 0 31 48 2\n21 19 1 80 110 2\n23 168 1 35 13 2\n27 67 1 72 62 2\n31 173 0 115 40 0\n52 87 0 116 100 0\n54 140 1 23 22 0\n55 200 1 71 70 2\n62 88 1 98 79 2\n66 139 0 103 141 2\n75 127 1 90 139 2\n88 66 0 72 62 2\n92 41 1 139 121 2\n96 79 1 126 12 0\n97 83 1 131 90 0\n102 196 1 93 97 2\n110 150 1 2 51 2\n118 12 1 114 35 0\n123 194 0 84 115 2\n124 195 1 93 97 2\n128 147 0 82 137 0\n136 138 0 39 106 2\n137 73 1 36 54 2\n139 76 1 120 44 0\n148 134 1 77 140 2\n151 143 0 29 60 2\n.. ... ... ... ... ...\n748 120 1 28 99 2\n751 129 1 100 117 2\n759 156 0 0 39 2\n763 39 0 26 46 2\n765 97 0 53 91 2\n772 116 0 135 135 2\n776 189 1 99 142 1\n779 152 0 79 21 2\n781 55 0 66 19 2\n782 113 1 20 111 2\n789 84 1 120 43 0\n796 108 0 64 93 2\n802 36 1 26 46 2\n806 6 1 9 11 2\n809 43 0 37 136 2\n815 72 1 11 16 2\n820 94 0 49 36 2\n823 130 0 100 117 2\n835 48 0 128 129 0\n839 119 1 46 67 0\n849 78 0 61 85 0\n853 112 0 119 98 2\n857 52 1 18 118 2\n862 180 0 65 93 2\n867 153 1 118 6 2\n871 18 0 38 101 2\n872 35 1 102 33 2\n879 151 0 43 69 0\n887 80 0 10 29 2\n889 20 1 8 59 0\n\n[202 rows x 5 columns]", | |
"text/html": "<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Name</th>\n <th>Sex</th>\n <th>Ticket</th>\n <th>Cabin</th>\n <th>Embarked</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>1</th>\n <td>51</td>\n <td>0</td>\n <td>123</td>\n <td>80</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>74</td>\n <td>0</td>\n <td>36</td>\n <td>54</td>\n <td>2</td>\n </tr>\n <tr>\n <th>6</th>\n <td>122</td>\n <td>1</td>\n <td>62</td>\n <td>128</td>\n <td>2</td>\n </tr>\n <tr>\n <th>10</th>\n <td>161</td>\n <td>0</td>\n <td>134</td>\n <td>144</td>\n <td>2</td>\n </tr>\n <tr>\n <th>11</th>\n <td>27</td>\n <td>0</td>\n <td>31</td>\n <td>48</td>\n <td>2</td>\n </tr>\n <tr>\n <th>21</th>\n <td>19</td>\n <td>1</td>\n <td>80</td>\n <td>110</td>\n <td>2</td>\n </tr>\n <tr>\n <th>23</th>\n <td>168</td>\n <td>1</td>\n <td>35</td>\n <td>13</td>\n <td>2</td>\n </tr>\n <tr>\n <th>27</th>\n <td>67</td>\n <td>1</td>\n <td>72</td>\n <td>62</td>\n <td>2</td>\n </tr>\n <tr>\n <th>31</th>\n <td>173</td>\n <td>0</td>\n <td>115</td>\n <td>40</td>\n <td>0</td>\n </tr>\n <tr>\n <th>52</th>\n <td>87</td>\n <td>0</td>\n <td>116</td>\n <td>100</td>\n <td>0</td>\n </tr>\n <tr>\n <th>54</th>\n <td>140</td>\n <td>1</td>\n <td>23</td>\n <td>22</td>\n <td>0</td>\n </tr>\n <tr>\n <th>55</th>\n <td>200</td>\n <td>1</td>\n <td>71</td>\n <td>70</td>\n <td>2</td>\n </tr>\n <tr>\n <th>62</th>\n <td>88</td>\n <td>1</td>\n <td>98</td>\n <td>79</td>\n <td>2</td>\n </tr>\n <tr>\n <th>66</th>\n <td>139</td>\n <td>0</td>\n <td>103</td>\n <td>141</td>\n <td>2</td>\n </tr>\n <tr>\n <th>75</th>\n <td>127</td>\n <td>1</td>\n <td>90</td>\n <td>139</td>\n <td>2</td>\n </tr>\n <tr>\n <th>88</th>\n <td>66</td>\n <td>0</td>\n <td>72</td>\n <td>62</td>\n <td>2</td>\n </tr>\n <tr>\n <th>92</th>\n <td>41</td>\n <td>1</td>\n <td>139</td>\n <td>121</td>\n <td>2</td>\n </tr>\n <tr>\n <th>96</th>\n <td>79</td>\n <td>1</td>\n <td>126</td>\n <td>12</td>\n <td>0</td>\n </tr>\n <tr>\n <th>97</th>\n <td>83</td>\n <td>1</td>\n <td>131</td>\n <td>90</td>\n <td>0</td>\n </tr>\n <tr>\n <th>102</th>\n <td>196</td>\n <td>1</td>\n <td>93</td>\n <td>97</td>\n <td>2</td>\n </tr>\n <tr>\n <th>110</th>\n <td>150</td>\n <td>1</td>\n <td>2</td>\n <td>51</td>\n <td>2</td>\n </tr>\n <tr>\n <th>118</th>\n <td>12</td>\n <td>1</td>\n <td>114</td>\n <td>35</td>\n <td>0</td>\n </tr>\n <tr>\n <th>123</th>\n <td>194</td>\n <td>0</td>\n <td>84</td>\n <td>115</td>\n <td>2</td>\n </tr>\n <tr>\n <th>124</th>\n <td>195</td>\n <td>1</td>\n <td>93</td>\n <td>97</td>\n <td>2</td>\n </tr>\n <tr>\n <th>128</th>\n <td>147</td>\n <td>0</td>\n <td>82</td>\n <td>137</td>\n <td>0</td>\n </tr>\n <tr>\n <th>136</th>\n <td>138</td>\n <td>0</td>\n <td>39</td>\n <td>106</td>\n <td>2</td>\n </tr>\n <tr>\n <th>137</th>\n <td>73</td>\n <td>1</td>\n <td>36</td>\n <td>54</td>\n <td>2</td>\n </tr>\n <tr>\n <th>139</th>\n <td>76</td>\n <td>1</td>\n <td>120</td>\n <td>44</td>\n <td>0</td>\n </tr>\n <tr>\n <th>148</th>\n <td>134</td>\n <td>1</td>\n <td>77</td>\n <td>140</td>\n <td>2</td>\n </tr>\n <tr>\n <th>151</th>\n <td>143</td>\n <td>0</td>\n <td>29</td>\n <td>60</td>\n <td>2</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>748</th>\n <td>120</td>\n <td>1</td>\n <td>28</td>\n <td>99</td>\n <td>2</td>\n </tr>\n <tr>\n <th>751</th>\n <td>129</td>\n <td>1</td>\n <td>100</td>\n <td>117</td>\n <td>2</td>\n </tr>\n <tr>\n <th>759</th>\n <td>156</td>\n <td>0</td>\n <td>0</td>\n <td>39</td>\n <td>2</td>\n </tr>\n <tr>\n <th>763</th>\n <td>39</td>\n <td>0</td>\n <td>26</td>\n <td>46</td>\n <td>2</td>\n </tr>\n <tr>\n <th>765</th>\n <td>97</td>\n <td>0</td>\n <td>53</td>\n <td>91</td>\n <td>2</td>\n </tr>\n <tr>\n <th>772</th>\n <td>116</td>\n <td>0</td>\n <td>135</td>\n <td>135</td>\n <td>2</td>\n </tr>\n <tr>\n <th>776</th>\n <td>189</td>\n <td>1</td>\n <td>99</td>\n <td>142</td>\n <td>1</td>\n </tr>\n <tr>\n <th>779</th>\n <td>152</td>\n <td>0</td>\n <td>79</td>\n <td>21</td>\n <td>2</td>\n </tr>\n <tr>\n <th>781</th>\n <td>55</td>\n <td>0</td>\n <td>66</td>\n <td>19</td>\n <td>2</td>\n </tr>\n <tr>\n <th>782</th>\n <td>113</td>\n <td>1</td>\n <td>20</td>\n <td>111</td>\n <td>2</td>\n </tr>\n <tr>\n <th>789</th>\n <td>84</td>\n <td>1</td>\n <td>120</td>\n <td>43</td>\n <td>0</td>\n </tr>\n <tr>\n <th>796</th>\n <td>108</td>\n <td>0</td>\n <td>64</td>\n <td>93</td>\n <td>2</td>\n </tr>\n <tr>\n <th>802</th>\n <td>36</td>\n <td>1</td>\n <td>26</td>\n <td>46</td>\n <td>2</td>\n </tr>\n <tr>\n <th>806</th>\n <td>6</td>\n <td>1</td>\n <td>9</td>\n <td>11</td>\n <td>2</td>\n </tr>\n <tr>\n <th>809</th>\n <td>43</td>\n <td>0</td>\n <td>37</td>\n <td>136</td>\n <td>2</td>\n </tr>\n <tr>\n <th>815</th>\n <td>72</td>\n <td>1</td>\n <td>11</td>\n <td>16</td>\n <td>2</td>\n </tr>\n <tr>\n <th>820</th>\n <td>94</td>\n <td>0</td>\n <td>49</td>\n <td>36</td>\n <td>2</td>\n </tr>\n <tr>\n <th>823</th>\n <td>130</td>\n <td>0</td>\n <td>100</td>\n <td>117</td>\n <td>2</td>\n </tr>\n <tr>\n <th>835</th>\n <td>48</td>\n <td>0</td>\n <td>128</td>\n <td>129</td>\n <td>0</td>\n </tr>\n <tr>\n <th>839</th>\n <td>119</td>\n <td>1</td>\n <td>46</td>\n <td>67</td>\n <td>0</td>\n </tr>\n <tr>\n <th>849</th>\n <td>78</td>\n <td>0</td>\n <td>61</td>\n <td>85</td>\n <td>0</td>\n </tr>\n <tr>\n <th>853</th>\n <td>112</td>\n <td>0</td>\n <td>119</td>\n <td>98</td>\n <td>2</td>\n </tr>\n <tr>\n <th>857</th>\n <td>52</td>\n <td>1</td>\n <td>18</td>\n <td>118</td>\n <td>2</td>\n </tr>\n <tr>\n <th>862</th>\n <td>180</td>\n <td>0</td>\n <td>65</td>\n <td>93</td>\n <td>2</td>\n </tr>\n <tr>\n <th>867</th>\n <td>153</td>\n <td>1</td>\n <td>118</td>\n <td>6</td>\n <td>2</td>\n </tr>\n <tr>\n <th>871</th>\n <td>18</td>\n <td>0</td>\n <td>38</td>\n <td>101</td>\n <td>2</td>\n </tr>\n <tr>\n <th>872</th>\n <td>35</td>\n <td>1</td>\n <td>102</td>\n <td>33</td>\n <td>2</td>\n </tr>\n <tr>\n <th>879</th>\n <td>151</td>\n <td>0</td>\n <td>43</td>\n <td>69</td>\n <td>0</td>\n </tr>\n <tr>\n <th>887</th>\n <td>80</td>\n <td>0</td>\n <td>10</td>\n <td>29</td>\n <td>2</td>\n </tr>\n <tr>\n <th>889</th>\n <td>20</td>\n <td>1</td>\n <td>8</td>\n <td>59</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n<p>202 rows × 5 columns</p>\n</div>" | |
}, | |
"execution_count": 29, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "ohe = OneHotEncoder()", | |
"execution_count": 30, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X", | |
"execution_count": 31, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": " Name Sex Ticket Cabin Embarked\n1 51 0 123 80 0\n3 74 0 36 54 2\n6 122 1 62 128 2\n10 161 0 134 144 2\n11 27 0 31 48 2\n21 19 1 80 110 2\n23 168 1 35 13 2\n27 67 1 72 62 2\n31 173 0 115 40 0\n52 87 0 116 100 0\n54 140 1 23 22 0\n55 200 1 71 70 2\n62 88 1 98 79 2\n66 139 0 103 141 2\n75 127 1 90 139 2\n88 66 0 72 62 2\n92 41 1 139 121 2\n96 79 1 126 12 0\n97 83 1 131 90 0\n102 196 1 93 97 2\n110 150 1 2 51 2\n118 12 1 114 35 0\n123 194 0 84 115 2\n124 195 1 93 97 2\n128 147 0 82 137 0\n136 138 0 39 106 2\n137 73 1 36 54 2\n139 76 1 120 44 0\n148 134 1 77 140 2\n151 143 0 29 60 2\n.. ... ... ... ... ...\n748 120 1 28 99 2\n751 129 1 100 117 2\n759 156 0 0 39 2\n763 39 0 26 46 2\n765 97 0 53 91 2\n772 116 0 135 135 2\n776 189 1 99 142 1\n779 152 0 79 21 2\n781 55 0 66 19 2\n782 113 1 20 111 2\n789 84 1 120 43 0\n796 108 0 64 93 2\n802 36 1 26 46 2\n806 6 1 9 11 2\n809 43 0 37 136 2\n815 72 1 11 16 2\n820 94 0 49 36 2\n823 130 0 100 117 2\n835 48 0 128 129 0\n839 119 1 46 67 0\n849 78 0 61 85 0\n853 112 0 119 98 2\n857 52 1 18 118 2\n862 180 0 65 93 2\n867 153 1 118 6 2\n871 18 0 38 101 2\n872 35 1 102 33 2\n879 151 0 43 69 0\n887 80 0 10 29 2\n889 20 1 8 59 0\n\n[202 rows x 5 columns]", | |
"text/html": "<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Name</th>\n <th>Sex</th>\n <th>Ticket</th>\n <th>Cabin</th>\n <th>Embarked</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>1</th>\n <td>51</td>\n <td>0</td>\n <td>123</td>\n <td>80</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>74</td>\n <td>0</td>\n <td>36</td>\n <td>54</td>\n <td>2</td>\n </tr>\n <tr>\n <th>6</th>\n <td>122</td>\n <td>1</td>\n <td>62</td>\n <td>128</td>\n <td>2</td>\n </tr>\n <tr>\n <th>10</th>\n <td>161</td>\n <td>0</td>\n <td>134</td>\n <td>144</td>\n <td>2</td>\n </tr>\n <tr>\n <th>11</th>\n <td>27</td>\n <td>0</td>\n <td>31</td>\n <td>48</td>\n <td>2</td>\n </tr>\n <tr>\n <th>21</th>\n <td>19</td>\n <td>1</td>\n <td>80</td>\n <td>110</td>\n <td>2</td>\n </tr>\n <tr>\n <th>23</th>\n <td>168</td>\n <td>1</td>\n <td>35</td>\n <td>13</td>\n <td>2</td>\n </tr>\n <tr>\n <th>27</th>\n <td>67</td>\n <td>1</td>\n <td>72</td>\n <td>62</td>\n <td>2</td>\n </tr>\n <tr>\n <th>31</th>\n <td>173</td>\n <td>0</td>\n <td>115</td>\n <td>40</td>\n <td>0</td>\n </tr>\n <tr>\n <th>52</th>\n <td>87</td>\n <td>0</td>\n <td>116</td>\n <td>100</td>\n <td>0</td>\n </tr>\n <tr>\n <th>54</th>\n <td>140</td>\n <td>1</td>\n <td>23</td>\n <td>22</td>\n <td>0</td>\n </tr>\n <tr>\n <th>55</th>\n <td>200</td>\n <td>1</td>\n <td>71</td>\n <td>70</td>\n <td>2</td>\n </tr>\n <tr>\n <th>62</th>\n <td>88</td>\n <td>1</td>\n <td>98</td>\n <td>79</td>\n <td>2</td>\n </tr>\n <tr>\n <th>66</th>\n <td>139</td>\n <td>0</td>\n <td>103</td>\n <td>141</td>\n <td>2</td>\n </tr>\n <tr>\n <th>75</th>\n <td>127</td>\n <td>1</td>\n <td>90</td>\n <td>139</td>\n <td>2</td>\n </tr>\n <tr>\n <th>88</th>\n <td>66</td>\n <td>0</td>\n <td>72</td>\n <td>62</td>\n <td>2</td>\n </tr>\n <tr>\n <th>92</th>\n <td>41</td>\n <td>1</td>\n <td>139</td>\n <td>121</td>\n <td>2</td>\n </tr>\n <tr>\n <th>96</th>\n <td>79</td>\n <td>1</td>\n <td>126</td>\n <td>12</td>\n <td>0</td>\n </tr>\n <tr>\n <th>97</th>\n <td>83</td>\n <td>1</td>\n <td>131</td>\n <td>90</td>\n <td>0</td>\n </tr>\n <tr>\n <th>102</th>\n <td>196</td>\n <td>1</td>\n <td>93</td>\n <td>97</td>\n <td>2</td>\n </tr>\n <tr>\n <th>110</th>\n <td>150</td>\n <td>1</td>\n <td>2</td>\n <td>51</td>\n <td>2</td>\n </tr>\n <tr>\n <th>118</th>\n <td>12</td>\n <td>1</td>\n <td>114</td>\n <td>35</td>\n <td>0</td>\n </tr>\n <tr>\n <th>123</th>\n <td>194</td>\n <td>0</td>\n <td>84</td>\n <td>115</td>\n <td>2</td>\n </tr>\n <tr>\n <th>124</th>\n <td>195</td>\n <td>1</td>\n <td>93</td>\n <td>97</td>\n <td>2</td>\n </tr>\n <tr>\n <th>128</th>\n <td>147</td>\n <td>0</td>\n <td>82</td>\n <td>137</td>\n <td>0</td>\n </tr>\n <tr>\n <th>136</th>\n <td>138</td>\n <td>0</td>\n <td>39</td>\n <td>106</td>\n <td>2</td>\n </tr>\n <tr>\n <th>137</th>\n <td>73</td>\n <td>1</td>\n <td>36</td>\n <td>54</td>\n <td>2</td>\n </tr>\n <tr>\n <th>139</th>\n <td>76</td>\n <td>1</td>\n <td>120</td>\n <td>44</td>\n <td>0</td>\n </tr>\n <tr>\n <th>148</th>\n <td>134</td>\n <td>1</td>\n <td>77</td>\n <td>140</td>\n <td>2</td>\n </tr>\n <tr>\n <th>151</th>\n <td>143</td>\n <td>0</td>\n <td>29</td>\n <td>60</td>\n <td>2</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>748</th>\n <td>120</td>\n <td>1</td>\n <td>28</td>\n <td>99</td>\n <td>2</td>\n </tr>\n <tr>\n <th>751</th>\n <td>129</td>\n <td>1</td>\n <td>100</td>\n <td>117</td>\n <td>2</td>\n </tr>\n <tr>\n <th>759</th>\n <td>156</td>\n <td>0</td>\n <td>0</td>\n <td>39</td>\n <td>2</td>\n </tr>\n <tr>\n <th>763</th>\n <td>39</td>\n <td>0</td>\n <td>26</td>\n <td>46</td>\n <td>2</td>\n </tr>\n <tr>\n <th>765</th>\n <td>97</td>\n <td>0</td>\n <td>53</td>\n <td>91</td>\n <td>2</td>\n </tr>\n <tr>\n <th>772</th>\n <td>116</td>\n <td>0</td>\n <td>135</td>\n <td>135</td>\n <td>2</td>\n </tr>\n <tr>\n <th>776</th>\n <td>189</td>\n <td>1</td>\n <td>99</td>\n <td>142</td>\n <td>1</td>\n </tr>\n <tr>\n <th>779</th>\n <td>152</td>\n <td>0</td>\n <td>79</td>\n <td>21</td>\n <td>2</td>\n </tr>\n <tr>\n <th>781</th>\n <td>55</td>\n <td>0</td>\n <td>66</td>\n <td>19</td>\n <td>2</td>\n </tr>\n <tr>\n <th>782</th>\n <td>113</td>\n <td>1</td>\n <td>20</td>\n <td>111</td>\n <td>2</td>\n </tr>\n <tr>\n <th>789</th>\n <td>84</td>\n <td>1</td>\n <td>120</td>\n <td>43</td>\n <td>0</td>\n </tr>\n <tr>\n <th>796</th>\n <td>108</td>\n <td>0</td>\n <td>64</td>\n <td>93</td>\n <td>2</td>\n </tr>\n <tr>\n <th>802</th>\n <td>36</td>\n <td>1</td>\n <td>26</td>\n <td>46</td>\n <td>2</td>\n </tr>\n <tr>\n <th>806</th>\n <td>6</td>\n <td>1</td>\n <td>9</td>\n <td>11</td>\n <td>2</td>\n </tr>\n <tr>\n <th>809</th>\n <td>43</td>\n <td>0</td>\n <td>37</td>\n <td>136</td>\n <td>2</td>\n </tr>\n <tr>\n <th>815</th>\n <td>72</td>\n <td>1</td>\n <td>11</td>\n <td>16</td>\n <td>2</td>\n </tr>\n <tr>\n <th>820</th>\n <td>94</td>\n <td>0</td>\n <td>49</td>\n <td>36</td>\n <td>2</td>\n </tr>\n <tr>\n <th>823</th>\n <td>130</td>\n <td>0</td>\n <td>100</td>\n <td>117</td>\n <td>2</td>\n </tr>\n <tr>\n <th>835</th>\n <td>48</td>\n <td>0</td>\n <td>128</td>\n <td>129</td>\n <td>0</td>\n </tr>\n <tr>\n <th>839</th>\n <td>119</td>\n <td>1</td>\n <td>46</td>\n <td>67</td>\n <td>0</td>\n </tr>\n <tr>\n <th>849</th>\n <td>78</td>\n <td>0</td>\n <td>61</td>\n <td>85</td>\n <td>0</td>\n </tr>\n <tr>\n <th>853</th>\n <td>112</td>\n <td>0</td>\n <td>119</td>\n <td>98</td>\n <td>2</td>\n </tr>\n <tr>\n <th>857</th>\n <td>52</td>\n <td>1</td>\n <td>18</td>\n <td>118</td>\n <td>2</td>\n </tr>\n <tr>\n <th>862</th>\n <td>180</td>\n <td>0</td>\n <td>65</td>\n <td>93</td>\n <td>2</td>\n </tr>\n <tr>\n <th>867</th>\n <td>153</td>\n <td>1</td>\n <td>118</td>\n <td>6</td>\n <td>2</td>\n </tr>\n <tr>\n <th>871</th>\n <td>18</td>\n <td>0</td>\n <td>38</td>\n <td>101</td>\n <td>2</td>\n </tr>\n <tr>\n <th>872</th>\n <td>35</td>\n <td>1</td>\n <td>102</td>\n <td>33</td>\n <td>2</td>\n </tr>\n <tr>\n <th>879</th>\n <td>151</td>\n <td>0</td>\n <td>43</td>\n <td>69</td>\n <td>0</td>\n </tr>\n <tr>\n <th>887</th>\n <td>80</td>\n <td>0</td>\n <td>10</td>\n <td>29</td>\n <td>2</td>\n </tr>\n <tr>\n <th>889</th>\n <td>20</td>\n <td>1</td>\n <td>8</td>\n <td>59</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n<p>202 rows × 5 columns</p>\n</div>" | |
}, | |
"execution_count": 31, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "ohe.fit(X)", | |
"execution_count": 32, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "OneHotEncoder(categorical_features='all', dtype=<class 'float'>,\n handle_unknown='error', n_values='auto', sparse=True)" | |
}, | |
"execution_count": 32, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "onehotlabels = ohe.transform(X).toarray()", | |
"execution_count": 33, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "onehotlabels.shape", | |
"execution_count": 34, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "(202, 494)" | |
}, | |
"execution_count": 34, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "onehotlabels", | |
"execution_count": 35, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "array([[ 0., 0., 0., ..., 1., 0., 0.],\n [ 0., 0., 0., ..., 0., 0., 1.],\n [ 0., 0., 0., ..., 0., 0., 1.],\n ..., \n [ 0., 0., 0., ..., 1., 0., 0.],\n [ 0., 0., 0., ..., 0., 0., 1.],\n [ 0., 0., 0., ..., 1., 0., 0.]])" | |
}, | |
"execution_count": 35, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "type(onehotlabels)", | |
"execution_count": 36, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "numpy.ndarray" | |
}, | |
"execution_count": 36, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X2 = XX\n#X2 = X2.select_dtypes(include=[object])", | |
"execution_count": 37, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X2 = X2.dropna()", | |
"execution_count": 38, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X3 = ohe.fit_transform(X)", | |
"execution_count": 39, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "X3", | |
"execution_count": 40, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "<202x494 sparse matrix of type '<class 'numpy.float64'>'\n\twith 1010 stored elements in Compressed Sparse Row format>" | |
}, | |
"execution_count": 40, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Enron dataset" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import pickle\nimport os\nos.getcwd()\n\n", | |
"execution_count": 41, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "'C:\\\\Users\\\\tparmar\\\\Python\\\\Udacity'" | |
}, | |
"execution_count": 41, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "## Helpful reference: http://napitupulu-jon.appspot.com/posts/datasets-questions.html " | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data = pickle.load(open(\"./enron/ud120-projects-master/final_project/final_project_dataset.pkl\", \"rb\"))", | |
"execution_count": 42, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data.values()", | |
"execution_count": 43, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "dict_values([{'long_term_incentive': 'NaN', 'exercised_stock_options': 759557, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 759557, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 304805, 'exercised_stock_options': 436515, 'bonus': 750000, 'director_fees': 'NaN', 'salary': 272880, 'total_stock_value': 877611, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 441096, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 819288, 'total_payments': 2146973, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 151418, 'to_messages': 504, 'shared_receipt_with_poi': 50, 'restricted_stock': 151418, 'from_poi_to_this_person': 16, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 7961, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 7961, 'from_messages': 12}, {'long_term_incentive': 602671, 'exercised_stock_options': 'NaN', 'bonus': 800000, 'director_fees': 'NaN', 'salary': 224305, 'total_stock_value': 985032, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 985032, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 118134, 'poi': True, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 907502, 'total_payments': 2652612, 'from_messages': 'NaN'}, {'long_term_incentive': 1725545, 'exercised_stock_options': 1056320, 'bonus': 1100000, 'director_fees': 'NaN', 'salary': 251654, 'total_stock_value': 1416848, 'to_messages': 136, 'shared_receipt_with_poi': 114, 'restricted_stock': 360528, 'from_poi_to_this_person': 12, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 842924, 'deferred_income': -719000, 'other': 947, 'total_payments': 3202070, 'from_messages': 16}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 15364167, 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 261879, 'total_stock_value': 23817930, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 8453763, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 32047, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1829457, 'total_payments': 3123383, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 3285, 'bonus': 'NaN', 'director_fees': 3285, 'salary': 'NaN', 'total_stock_value': -44093, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 44093, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': -102500, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 102500, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 17500, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 653, 'shared_receipt_with_poi': 12, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': -17500, 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 26}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 880290, 'bonus': 400000, 'director_fees': 'NaN', 'salary': 197091, 'total_stock_value': 880290, 'to_messages': 1238, 'shared_receipt_with_poi': 742, 'restricted_stock': 409554, 'from_poi_to_this_person': 61, 'restricted_stock_deferred': -409554, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 43057, 'poi': False, 'from_this_person_to_poi': 48, 'deferral_payments': 1130036, 'deferred_income': -33333, 'other': 778, 'total_payments': 1737629, 'from_messages': 222}, {'long_term_incentive': 1736055, 'exercised_stock_options': 'NaN', 'bonus': 1300000, 'director_fees': 'NaN', 'salary': 440698, 'total_stock_value': 1794412, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 1794412, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 55921, 'poi': True, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -1386055, 'other': 277464, 'total_payments': 2424083, 'from_messages': 'NaN'}, {'long_term_incentive': 831809, 'exercised_stock_options': 765313, 'bonus': 850000, 'director_fees': 'NaN', 'salary': 248546, 'total_stock_value': 954354, 'to_messages': 2475, 'shared_receipt_with_poi': 2326, 'restricted_stock': 189041, 'from_poi_to_this_person': 25, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 84208, 'poi': False, 'from_this_person_to_poi': 2, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 272, 'total_payments': 2014835, 'from_messages': 14}, {'long_term_incentive': 312500, 'exercised_stock_options': 2165172, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 85274, 'total_stock_value': 5819980, 'to_messages': 496, 'shared_receipt_with_poi': 437, 'restricted_stock': 3654808, 'from_poi_to_this_person': 28, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 28093, 'poi': False, 'from_this_person_to_poi': 5, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1553729, 'total_payments': 1979596, 'from_messages': 19}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 506765, 'bonus': 900000, 'director_fees': 'NaN', 'salary': 263413, 'total_stock_value': 947861, 'to_messages': 1744, 'shared_receipt_with_poi': 1469, 'restricted_stock': 441096, 'from_poi_to_this_person': 52, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 228763, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': -125000, 'other': 51587, 'total_payments': 1318763, 'from_messages': 49}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 953136, 'bonus': 5249999, 'director_fees': 'NaN', 'salary': 213999, 'total_stock_value': 1110705, 'to_messages': 7991, 'shared_receipt_with_poi': 5521, 'restricted_stock': 157569, 'from_poi_to_this_person': 228, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 17355, 'poi': True, 'from_this_person_to_poi': 108, 'deferral_payments': 2144013, 'deferred_income': -2334434, 'other': 210698, 'total_payments': 5501630, 'from_messages': 484}, {'long_term_incentive': 180250, 'exercised_stock_options': 'NaN', 'bonus': 250000, 'director_fees': 'NaN', 'salary': 187922, 'total_stock_value': 659249, 'to_messages': 383, 'shared_receipt_with_poi': 233, 'restricted_stock': 659249, 'from_poi_to_this_person': 4, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 59175, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': -485813, 'other': 427316, 'total_payments': 618850, 'from_messages': 59}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1753766, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1945360, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 264013, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -72419, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 974293, 'exercised_stock_options': 'NaN', 'bonus': 1350000, 'director_fees': 'NaN', 'salary': 278601, 'total_stock_value': 252055, 'to_messages': 1858, 'shared_receipt_with_poi': 1593, 'restricted_stock': 252055, 'from_poi_to_this_person': 140, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 65907, 'poi': True, 'from_this_person_to_poi': 15, 'deferral_payments': 'NaN', 'deferred_income': -833, 'other': 1621, 'total_payments': 2669589, 'from_messages': 27}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 368705, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 463261, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -94556, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 774401, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 774401, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 412878, 'bonus': 'NaN', 'director_fees': 112492, 'salary': 'NaN', 'total_stock_value': 412878, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -25000, 'other': 'NaN', 'total_payments': 87492, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 98718, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 98718, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 48521928, 'exercised_stock_options': 311764000, 'bonus': 97343619, 'director_fees': 1398517, 'salary': 26704229, 'total_stock_value': 434509511, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 130322299, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -7576788, 'email_address': 'NaN', 'loan_advances': 83925000, 'expenses': 5235198, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 32083396, 'deferred_income': -27992891, 'other': 42667589, 'total_payments': 309886585, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 139130, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 139130, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 71023, 'exercised_stock_options': 384728, 'bonus': 600000, 'director_fees': 'NaN', 'salary': 274975, 'total_stock_value': 778546, 'to_messages': 873, 'shared_receipt_with_poi': 874, 'restricted_stock': 393818, 'from_poi_to_this_person': 52, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 125978, 'poi': True, 'from_this_person_to_poi': 6, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 200308, 'total_payments': 1272284, 'from_messages': 16}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 850477, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 850477, 'to_messages': 952, 'shared_receipt_with_poi': 739, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 26}, {'long_term_incentive': 769862, 'exercised_stock_options': 2542813, 'bonus': 900000, 'director_fees': 'NaN', 'salary': 330546, 'total_stock_value': 3444470, 'to_messages': 3523, 'shared_receipt_with_poi': 2333, 'restricted_stock': 901657, 'from_poi_to_this_person': 156, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 71, 'deferral_payments': 649584, 'deferred_income': -694862, 'other': 400572, 'total_payments': 2355702, 'from_messages': 1053}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 109298, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 103773, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 213071, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 38346, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 2151, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -38346, 'other': 'NaN', 'total_payments': 2151, 'from_messages': 'NaN'}, {'long_term_incentive': 415657, 'exercised_stock_options': 2027865, 'bonus': 425000, 'director_fees': 'NaN', 'salary': 210500, 'total_stock_value': 2027865, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 315068, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -315068, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 52255, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 875307, 'deferred_income': -775241, 'other': 1105, 'total_payments': 1204583, 'from_messages': 'NaN'}, {'long_term_incentive': 1387399, 'exercised_stock_options': 'NaN', 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 273746, 'total_stock_value': 360528, 'to_messages': 2822, 'shared_receipt_with_poi': 2672, 'restricted_stock': 360528, 'from_poi_to_this_person': 67, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 14, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 3083, 'total_payments': 2664228, 'from_messages': 63}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 117551, 'bonus': 800000, 'director_fees': 'NaN', 'salary': 314288, 'total_stock_value': 495633, 'to_messages': 102, 'shared_receipt_with_poi': 71, 'restricted_stock': 378082, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 27861, 'poi': False, 'from_this_person_to_poi': 4, 'deferral_payments': 'NaN', 'deferred_income': -41250, 'other': 494, 'total_payments': 1101393, 'from_messages': 33}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 113784, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 1279, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -113784, 'other': 'NaN', 'total_payments': 1279, 'from_messages': 'NaN'}, {'long_term_incentive': 300000, 'exercised_stock_options': 671737, 'bonus': 700000, 'director_fees': 'NaN', 'salary': 309946, 'total_stock_value': 1920055, 'to_messages': 2374, 'shared_receipt_with_poi': 2271, 'restricted_stock': 1248318, 'from_poi_to_this_person': 53, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 127017, 'poi': True, 'from_this_person_to_poi': 15, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 150458, 'total_payments': 1587421, 'from_messages': 61}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 757301, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1691366, 'to_messages': 894, 'shared_receipt_with_poi': 720, 'restricted_stock': 934065, 'from_poi_to_this_person': 54, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 13}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 400000, 'director_fees': 'NaN', 'salary': 239671, 'total_stock_value': 63014, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 145796, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -82782, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 129142, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 260455, 'deferred_income': -201641, 'other': 69, 'total_payments': 827696, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 103750, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 148, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -103750, 'other': 'NaN', 'total_payments': 148, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 83237, 'bonus': 509870, 'director_fees': 'NaN', 'salary': 192008, 'total_stock_value': 318607, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 235370, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 50080, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 73122, 'deferred_income': -1042, 'other': 76547, 'total_payments': 900585, 'from_messages': 'NaN'}, {'long_term_incentive': 323466, 'exercised_stock_options': 850010, 'bonus': 400000, 'director_fees': 'NaN', 'salary': 275101, 'total_stock_value': 976037, 'to_messages': 4607, 'shared_receipt_with_poi': 583, 'restricted_stock': 126027, 'from_poi_to_this_person': 41, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 83585, 'poi': False, 'from_this_person_to_poi': 171, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 4669, 'total_payments': 1086821, 'from_messages': 14368}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 788750, 'director_fees': 'NaN', 'salary': 288589, 'total_stock_value': 'NaN', 'to_messages': 111, 'shared_receipt_with_poi': 41, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 12, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 53122, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 1130461, 'from_messages': 18}, {'long_term_incentive': 175000, 'exercised_stock_options': 'NaN', 'bonus': 750000, 'director_fees': 'NaN', 'salary': 261516, 'total_stock_value': 417619, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 417619, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 9410, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -75000, 'other': 150656, 'total_payments': 1271582, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 1200000, 'director_fees': 'NaN', 'salary': 288542, 'total_stock_value': 698242, 'to_messages': 1758, 'shared_receipt_with_poi': 1132, 'restricted_stock': 698242, 'from_poi_to_this_person': 240, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 16514, 'poi': True, 'from_this_person_to_poi': 11, 'deferral_payments': 27610, 'deferred_income': -144062, 'other': 101740, 'total_payments': 1490344, 'from_messages': 40}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 81042, 'bonus': 3100000, 'director_fees': 'NaN', 'salary': 271442, 'total_stock_value': 547143, 'to_messages': 8305, 'shared_receipt_with_poi': 3669, 'restricted_stock': 466101, 'from_poi_to_this_person': 251, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 5774, 'poi': False, 'from_this_person_to_poi': 194, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 93925, 'total_payments': 3471141, 'from_messages': 1728}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 431750, 'bonus': 'NaN', 'director_fees': 108750, 'salary': 'NaN', 'total_stock_value': 431750, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 44093, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -44093, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -25000, 'other': 'NaN', 'total_payments': 83750, 'from_messages': 'NaN'}, {'long_term_incentive': 156250, 'exercised_stock_options': 4160672, 'bonus': 100000, 'director_fees': 'NaN', 'salary': 76399, 'total_stock_value': 4221891, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 201483, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -140264, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 8409, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 51365, 'deferred_income': -200000, 'other': 202052, 'total_payments': 394475, 'from_messages': 'NaN'}, {'long_term_incentive': 335349, 'exercised_stock_options': 17378, 'bonus': 600000, 'director_fees': 'NaN', 'salary': 206121, 'total_stock_value': 159211, 'to_messages': 714, 'shared_receipt_with_poi': 552, 'restricted_stock': 141833, 'from_poi_to_this_person': 115, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 41626, 'poi': False, 'from_this_person_to_poi': 4, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 25553, 'total_payments': 1208649, 'from_messages': 74}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 886231, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1095040, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 208809, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 564348, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 564348, 'from_messages': 'NaN'}, {'long_term_incentive': 100000, 'exercised_stock_options': 1637034, 'bonus': 750000, 'director_fees': 'NaN', 'salary': 329078, 'total_stock_value': 2606763, 'to_messages': 1184, 'shared_receipt_with_poi': 856, 'restricted_stock': 969729, 'from_poi_to_this_person': 20, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 63791, 'poi': False, 'from_this_person_to_poi': 15, 'deferral_payments': 77716, 'deferred_income': 'NaN', 'other': 972, 'total_payments': 1321557, 'from_messages': 52}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1297049, 'bonus': 450000, 'director_fees': 'NaN', 'salary': 317543, 'total_stock_value': 15144123, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 13847074, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 81353, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1085463, 'total_payments': 1934359, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 59539, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 221141, 'to_messages': 672, 'shared_receipt_with_poi': 127, 'restricted_stock': 161602, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 19}, {'long_term_incentive': 275000, 'exercised_stock_options': 'NaN', 'bonus': 325000, 'director_fees': 'NaN', 'salary': 184899, 'total_stock_value': 207940, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 207940, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 22344, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 713, 'total_payments': 807956, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 125034, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -121284, 'other': 'NaN', 'total_payments': 3750, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 2282768, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 130724, 'total_stock_value': 2282768, 'to_messages': 128, 'shared_receipt_with_poi': 119, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 4994, 'poi': False, 'from_this_person_to_poi': 17, 'deferral_payments': 2964506, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 3100224, 'from_messages': 17}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 4890344, 'bonus': 350000, 'director_fees': 'NaN', 'salary': 170941, 'total_stock_value': 6678735, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 1788391, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 78552, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -400729, 'other': 12961, 'total_payments': 211725, 'from_messages': 'NaN'}, {'long_term_incentive': 1920000, 'exercised_stock_options': 19250000, 'bonus': 5600000, 'director_fees': 'NaN', 'salary': 1111258, 'total_stock_value': 26093672, 'to_messages': 3627, 'shared_receipt_with_poi': 2042, 'restricted_stock': 6843672, 'from_poi_to_this_person': 88, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 29336, 'poi': True, 'from_this_person_to_poi': 30, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 22122, 'total_payments': 8682716, 'from_messages': 108}, {'long_term_incentive': 374347, 'exercised_stock_options': 940257, 'bonus': 2500000, 'director_fees': 'NaN', 'salary': 304588, 'total_stock_value': 2332399, 'to_messages': 1755, 'shared_receipt_with_poi': 1604, 'restricted_stock': 1392142, 'from_poi_to_this_person': 42, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 95924, 'poi': False, 'from_this_person_to_poi': 37, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 401481, 'total_payments': 3676340, 'from_messages': 75}, {'long_term_incentive': 1617011, 'exercised_stock_options': 10433518, 'bonus': 2000000, 'director_fees': 'NaN', 'salary': 1060932, 'total_stock_value': 14622185, 'to_messages': 3275, 'shared_receipt_with_poi': 2979, 'restricted_stock': 4188667, 'from_poi_to_this_person': 242, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 2000000, 'expenses': 86987, 'poi': False, 'from_this_person_to_poi': 6, 'deferral_payments': 6426990, 'deferred_income': -3367011, 'other': 7427621, 'total_payments': 17252530, 'from_messages': 21}, {'long_term_incentive': 694862, 'exercised_stock_options': 1104054, 'bonus': 2600000, 'director_fees': 'NaN', 'salary': 370448, 'total_stock_value': 1662855, 'to_messages': 2355, 'shared_receipt_with_poi': 2228, 'restricted_stock': 558801, 'from_poi_to_this_person': 58, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 137108, 'poi': False, 'from_this_person_to_poi': 26, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 297353, 'total_payments': 4099771, 'from_messages': 48}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 30766064, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 30766064, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 77978, 'poi': True, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 10259, 'deferred_income': 'NaN', 'other': 2856, 'total_payments': 91093, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 765920, 'bonus': 800000, 'director_fees': 'NaN', 'salary': 278601, 'total_stock_value': 1080988, 'to_messages': 865, 'shared_receipt_with_poi': 772, 'restricted_stock': 315068, 'from_poi_to_this_person': 188, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 96268, 'poi': False, 'from_this_person_to_poi': 11, 'deferral_payments': 'NaN', 'deferred_income': -300000, 'other': 891, 'total_payments': 875760, 'from_messages': 22}, {'long_term_incentive': 304805, 'exercised_stock_options': 825464, 'bonus': 500000, 'director_fees': 'NaN', 'salary': 248017, 'total_stock_value': 1014505, 'to_messages': 1088, 'shared_receipt_with_poi': 23, 'restricted_stock': 189041, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 600, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1215, 'total_payments': 1054637, 'from_messages': 125}, {'long_term_incentive': 983346, 'exercised_stock_options': 608750, 'bonus': 1150000, 'director_fees': 'NaN', 'salary': 374125, 'total_stock_value': 803094, 'to_messages': 4009, 'shared_receipt_with_poi': 1847, 'restricted_stock': 524169, 'from_poi_to_this_person': 180, 'restricted_stock_deferred': -329825, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 76169, 'poi': False, 'from_this_person_to_poi': 61, 'deferral_payments': 2157527, 'deferred_income': -934484, 'other': 52382, 'total_payments': 3859065, 'from_messages': 1941}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1624396, 'bonus': 200000, 'director_fees': 'NaN', 'salary': 211844, 'total_stock_value': 2493616, 'to_messages': 225, 'shared_receipt_with_poi': 91, 'restricted_stock': 869220, 'from_poi_to_this_person': 13, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 22884, 'poi': True, 'from_this_person_to_poi': 14, 'deferral_payments': 'NaN', 'deferred_income': -4167, 'other': 1573324, 'total_payments': 2003885, 'from_messages': 39}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1324578, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1884748, 'to_messages': 517, 'shared_receipt_with_poi': 10, 'restricted_stock': 560170, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 36}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1635238, 'bonus': 700000, 'director_fees': 'NaN', 'salary': 249201, 'total_stock_value': 1918887, 'to_messages': 1328, 'shared_receipt_with_poi': 1258, 'restricted_stock': 283649, 'from_poi_to_this_person': 35, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 33271, 'poi': True, 'from_this_person_to_poi': 48, 'deferral_payments': 214678, 'deferred_income': -100000, 'other': 1950, 'total_payments': 1099100, 'from_messages': 82}, {'long_term_incentive': 200000, 'exercised_stock_options': 1668260, 'bonus': 325000, 'director_fees': 'NaN', 'salary': 259996, 'total_stock_value': 2056427, 'to_messages': 400, 'shared_receipt_with_poi': 337, 'restricted_stock': 388167, 'from_poi_to_this_person': 22, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 7, 'deferral_payments': 831299, 'deferred_income': -583325, 'other': 1425, 'total_payments': 1034395, 'from_messages': 30}, {'long_term_incentive': 3600000, 'exercised_stock_options': 34348384, 'bonus': 7000000, 'director_fees': 'NaN', 'salary': 1072321, 'total_stock_value': 49110078, 'to_messages': 4273, 'shared_receipt_with_poi': 2411, 'restricted_stock': 14761694, 'from_poi_to_this_person': 123, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 81525000, 'expenses': 99832, 'poi': True, 'from_this_person_to_poi': 16, 'deferral_payments': 202911, 'deferred_income': -300000, 'other': 10359729, 'total_payments': 103559793, 'from_messages': 36}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 98784, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 32460, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -32460, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -98784, 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 1486, 'shared_receipt_with_poi': 761, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 13, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 49288, 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 49288, 'from_messages': 41}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 174246, 'total_stock_value': 1034346, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 1034346, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 116335, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -51042, 'other': 465357, 'total_payments': 704896, 'from_messages': 'NaN'}, {'long_term_incentive': 540751, 'exercised_stock_options': 4346544, 'bonus': 850000, 'director_fees': 'NaN', 'salary': 357091, 'total_stock_value': 5898997, 'to_messages': 671, 'shared_receipt_with_poi': 215, 'restricted_stock': 1552453, 'from_poi_to_this_person': 17, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 50936, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 2, 'total_payments': 1798780, 'from_messages': 146}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 9803, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 85641, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 75838, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 119292, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 119292, 'from_messages': 'NaN'}, {'long_term_incentive': 554422, 'exercised_stock_options': 1441898, 'bonus': 2000000, 'director_fees': 'NaN', 'salary': 304110, 'total_stock_value': 2072035, 'to_messages': 3221, 'shared_receipt_with_poi': 1730, 'restricted_stock': 630137, 'from_poi_to_this_person': 94, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 178979, 'poi': False, 'from_this_person_to_poi': 83, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1191, 'total_payments': 3038702, 'from_messages': 2681}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 600000, 'director_fees': 'NaN', 'salary': 365788, 'total_stock_value': 585062, 'to_messages': 807, 'shared_receipt_with_poi': 702, 'restricted_stock': 585062, 'from_poi_to_this_person': 38, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 94299, 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1740, 'total_payments': 1061827, 'from_messages': 29}, {'long_term_incentive': 554422, 'exercised_stock_options': 1623010, 'bonus': 1100000, 'director_fees': 'NaN', 'salary': 365038, 'total_stock_value': 3101279, 'to_messages': 3329, 'shared_receipt_with_poi': 2189, 'restricted_stock': 1478269, 'from_poi_to_this_person': 92, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 81364, 'poi': False, 'from_this_person_to_poi': 194, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 540, 'total_payments': 2101364, 'from_messages': 2742}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 700000, 'director_fees': 'NaN', 'salary': 231330, 'total_stock_value': 126027, 'to_messages': 7315, 'shared_receipt_with_poi': 2639, 'restricted_stock': 126027, 'from_poi_to_this_person': 144, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 37172, 'poi': False, 'from_this_person_to_poi': 386, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 566, 'total_payments': 969068, 'from_messages': 4343}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1624396, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 216582, 'total_stock_value': 2493616, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 869220, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 11892, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 228474, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 371750, 'bonus': 'NaN', 'director_fees': 102492, 'salary': 'NaN', 'total_stock_value': 371750, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -25000, 'other': 'NaN', 'total_payments': 77492, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 189518, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 662086, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -472568, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 808346, 'exercised_stock_options': 3282960, 'bonus': 3000000, 'director_fees': 'NaN', 'salary': 510364, 'total_stock_value': 6079137, 'to_messages': 6019, 'shared_receipt_with_poi': 3920, 'restricted_stock': 2796177, 'from_poi_to_this_person': 186, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 57838, 'poi': False, 'from_this_person_to_poi': 24, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 301026, 'total_payments': 4677574, 'from_messages': 556}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 101250, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 27942, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -101250, 'other': 'NaN', 'total_payments': 27942, 'from_messages': 'NaN'}, {'long_term_incentive': 93750, 'exercised_stock_options': 1599641, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 80818, 'total_stock_value': 1599641, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 684694, 'deferred_income': 'NaN', 'other': 874, 'total_payments': 860136, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 176378, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 176378, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 50591, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 50591, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 8308552, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 158403, 'total_stock_value': 11884758, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 3576206, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 53947, 'poi': True, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 147950, 'total_payments': 360300, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 325000, 'director_fees': 'NaN', 'salary': 267093, 'total_stock_value': 208510, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 208510, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 35018, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1411, 'total_payments': 628522, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 2217299, 'to_messages': 573, 'shared_receipt_with_poi': 471, 'restricted_stock': 2217299, 'from_poi_to_this_person': 4, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 475, 'poi': False, 'from_this_person_to_poi': 7, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 475, 'from_messages': 19}, {'long_term_incentive': 69223, 'exercised_stock_options': 'NaN', 'bonus': 1700000, 'director_fees': 'NaN', 'salary': 211788, 'total_stock_value': 441096, 'to_messages': 1320, 'shared_receipt_with_poi': 900, 'restricted_stock': 441096, 'from_poi_to_this_person': 40, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 98849, 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1936, 'total_payments': 2081796, 'from_messages': 27}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 5210569, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 7256648, 'to_messages': 2350, 'shared_receipt_with_poi': 1074, 'restricted_stock': 2046079, 'from_poi_to_this_person': 44, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 15, 'deferral_payments': 3131860, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 3131860, 'from_messages': 1073}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 189583, 'total_payments': 189583, 'from_messages': 'NaN'}, {'long_term_incentive': 275000, 'exercised_stock_options': 591250, 'bonus': 300000, 'director_fees': 'NaN', 'salary': 247338, 'total_stock_value': 1168042, 'to_messages': 460, 'shared_receipt_with_poi': 379, 'restricted_stock': 576792, 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 11, 'deferral_payments': 'NaN', 'deferred_income': -575000, 'other': 152055, 'total_payments': 399393, 'from_messages': 19}, {'long_term_incentive': 1617011, 'exercised_stock_options': 19794175, 'bonus': 1750000, 'director_fees': 'NaN', 'salary': 420636, 'total_stock_value': 22542539, 'to_messages': 905, 'shared_receipt_with_poi': 864, 'restricted_stock': 2748364, 'from_poi_to_this_person': 42, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 46950, 'poi': True, 'from_this_person_to_poi': 4, 'deferral_payments': 'NaN', 'deferred_income': -3504386, 'other': 174839, 'total_payments': 505050, 'from_messages': 18}, {'long_term_incentive': 375304, 'exercised_stock_options': 'NaN', 'bonus': 1250000, 'director_fees': 'NaN', 'salary': 240189, 'total_stock_value': 126027, 'to_messages': 2598, 'shared_receipt_with_poi': 2188, 'restricted_stock': 126027, 'from_poi_to_this_person': 199, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 35818, 'poi': True, 'from_this_person_to_poi': 25, 'deferral_payments': 'NaN', 'deferred_income': -262500, 'other': 486, 'total_payments': 1639297, 'from_messages': 144}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1030329, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1030329, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 33785, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 53625, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 87410, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 500000, 'director_fees': 'NaN', 'salary': 239502, 'total_stock_value': 511734, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 511734, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 16514, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 356071, 'total_payments': 1112087, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 343434, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 343434, 'to_messages': 57, 'shared_receipt_with_poi': 2, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 181755, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 181755, 'from_messages': 13}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 754966, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1118394, 'to_messages': 719, 'shared_receipt_with_poi': 589, 'restricted_stock': 363428, 'from_poi_to_this_person': 35, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 5, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 34}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 2604490, 'bonus': 'NaN', 'director_fees': 137864, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 523, 'shared_receipt_with_poi': 463, 'restricted_stock': -2604490, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 15456290, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 137864, 'total_payments': 15456290, 'from_messages': 29}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 108579, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 1413, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -25000, 'other': 'NaN', 'total_payments': 84992, 'from_messages': 'NaN'}, {'long_term_incentive': 350000, 'exercised_stock_options': 'NaN', 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 415189, 'total_stock_value': 2502063, 'to_messages': 1892, 'shared_receipt_with_poi': 1585, 'restricted_stock': 2502063, 'from_poi_to_this_person': 58, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 30674, 'poi': True, 'from_this_person_to_poi': 12, 'deferral_payments': 'NaN', 'deferred_income': -235000, 'other': 307895, 'total_payments': 1868758, 'from_messages': 49}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 346663, 'to_messages': 2649, 'shared_receipt_with_poi': 571, 'restricted_stock': 346663, 'from_poi_to_this_person': 35, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 38, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 1061}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 5127155, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 6077885, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 950730, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 493489, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 955873, 'to_messages': 232, 'shared_receipt_with_poi': 22, 'restricted_stock': 462384, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 1848227, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 1848227, 'from_messages': 28}, {'long_term_incentive': 300000, 'exercised_stock_options': 2022048, 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 404338, 'total_stock_value': 6153642, 'to_messages': 12754, 'shared_receipt_with_poi': 3639, 'restricted_stock': 4131594, 'from_poi_to_this_person': 140, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 41953, 'poi': False, 'from_this_person_to_poi': 387, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1231, 'total_payments': 1747522, 'from_messages': 6759}, {'long_term_incentive': 304805, 'exercised_stock_options': 1729541, 'bonus': 4175000, 'director_fees': 'NaN', 'salary': 201955, 'total_stock_value': 1729541, 'to_messages': 2902, 'shared_receipt_with_poi': 1407, 'restricted_stock': 126027, 'from_poi_to_this_person': 47, 'restricted_stock_deferred': -126027, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 13868, 'poi': False, 'from_this_person_to_poi': 65, 'deferral_payments': 2869717, 'deferred_income': -3081055, 'other': 152, 'total_payments': 4484442, 'from_messages': 2195}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 651850, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1038185, 'to_messages': 764, 'shared_receipt_with_poi': 58, 'restricted_stock': 386335, 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 12}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 1426469, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 1832468, 'to_messages': 613, 'shared_receipt_with_poi': 583, 'restricted_stock': 405999, 'from_poi_to_this_person': 39, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 18, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 25}, {'long_term_incentive': 1105218, 'exercised_stock_options': 1451869, 'bonus': 750000, 'director_fees': 'NaN', 'salary': 210692, 'total_stock_value': 1640910, 'to_messages': 904, 'shared_receipt_with_poi': 599, 'restricted_stock': 189041, 'from_poi_to_this_person': 106, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 25785, 'poi': False, 'from_this_person_to_poi': 3, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1568, 'total_payments': 2093263, 'from_messages': 12}, {'long_term_incentive': 365625, 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 6615, 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 93585, 'deferred_income': 'NaN', 'other': 680833, 'total_payments': 1146658, 'from_messages': 'NaN'}, {'long_term_incentive': 175000, 'exercised_stock_options': 2549361, 'bonus': 200000, 'director_fees': 'NaN', 'salary': 236457, 'total_stock_value': 3064208, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 514847, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 57727, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 204075, 'deferred_income': 'NaN', 'other': 2630, 'total_payments': 875889, 'from_messages': 'NaN'}, {'long_term_incentive': 5145434, 'exercised_stock_options': 2070306, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 349487, 'total_stock_value': 2070306, 'to_messages': 1522, 'shared_receipt_with_poi': 477, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 8, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 8211, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 85430, 'deferred_income': 'NaN', 'other': 2818454, 'total_payments': 8407016, 'from_messages': 230}, {'long_term_incentive': 1586055, 'exercised_stock_options': 6680544, 'bonus': 1200000, 'director_fees': 'NaN', 'salary': 267102, 'total_stock_value': 10623258, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 3942714, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 11200, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 1295738, 'deferred_income': -1386055, 'other': 2660303, 'total_payments': 5634343, 'from_messages': 'NaN'}, {'long_term_incentive': 125000, 'exercised_stock_options': 400478, 'bonus': 400000, 'director_fees': 'NaN', 'salary': 229284, 'total_stock_value': 597461, 'to_messages': 2192, 'shared_receipt_with_poi': 395, 'restricted_stock': 196983, 'from_poi_to_this_person': 11, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 57580, 'poi': False, 'from_this_person_to_poi': 2, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 330, 'total_payments': 812194, 'from_messages': 45}, {'long_term_incentive': 554422, 'exercised_stock_options': 1835558, 'bonus': 1500000, 'director_fees': 'NaN', 'salary': 428780, 'total_stock_value': 3128982, 'to_messages': 3187, 'shared_receipt_with_poi': 2103, 'restricted_stock': 1293424, 'from_poi_to_this_person': 28, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 23, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1852186, 'total_payments': 4335388, 'from_messages': 92}, {'long_term_incentive': 461912, 'exercised_stock_options': 2218275, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 2218275, 'to_messages': 169, 'shared_receipt_with_poi': 23, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 504610, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 966522, 'from_messages': 12}, {'long_term_incentive': 422158, 'exercised_stock_options': 281073, 'bonus': 600000, 'director_fees': 'NaN', 'salary': 248146, 'total_stock_value': 494136, 'to_messages': 3136, 'shared_receipt_with_poi': 2477, 'restricted_stock': 213063, 'from_poi_to_this_person': 24, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 116337, 'poi': False, 'from_this_person_to_poi': 6, 'deferral_payments': 187469, 'deferred_income': 'NaN', 'other': 2401, 'total_payments': 1576511, 'from_messages': 136}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 372205, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 372205, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 153686, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': -153686, 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 'NaN'}, {'long_term_incentive': 556416, 'exercised_stock_options': 664461, 'bonus': 350000, 'director_fees': 'NaN', 'salary': 199157, 'total_stock_value': 1621236, 'to_messages': 936, 'shared_receipt_with_poi': 723, 'restricted_stock': 956775, 'from_poi_to_this_person': 1, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 23870, 'poi': False, 'from_this_person_to_poi': 8, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 285414, 'total_payments': 1414857, 'from_messages': 16}, {'long_term_incentive': 694862, 'exercised_stock_options': 8191755, 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 262788, 'total_stock_value': 8317782, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 126027, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 35812, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 374689, 'total_payments': 2368151, 'from_messages': 'NaN'}, {'long_term_incentive': 2035380, 'exercised_stock_options': 4158995, 'bonus': 8000000, 'director_fees': 'NaN', 'salary': 339288, 'total_stock_value': 5167144, 'to_messages': 7259, 'shared_receipt_with_poi': 3962, 'restricted_stock': 1008149, 'from_poi_to_this_person': 528, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 49537, 'poi': False, 'from_this_person_to_poi': 411, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1552, 'total_payments': 10425757, 'from_messages': 2585}, {'long_term_incentive': 1617011, 'exercised_stock_options': 5538001, 'bonus': 1500000, 'director_fees': 'NaN', 'salary': 243293, 'total_stock_value': 6391065, 'to_messages': 1045, 'shared_receipt_with_poi': 1035, 'restricted_stock': 853064, 'from_poi_to_this_person': 32, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 34039, 'poi': True, 'from_this_person_to_poi': 21, 'deferral_payments': 'NaN', 'deferred_income': -3117011, 'other': 11350, 'total_payments': 288682, 'from_messages': 32}, {'long_term_incentive': 2234774, 'exercised_stock_options': 601438, 'bonus': 200000, 'director_fees': 'NaN', 'salary': 182245, 'total_stock_value': 1008941, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 407503, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 21530, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 53775, 'total_payments': 2692324, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 3181250, 'bonus': 600000, 'director_fees': 'NaN', 'salary': 265214, 'total_stock_value': 3745048, 'to_messages': 533, 'shared_receipt_with_poi': 300, 'restricted_stock': 563798, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 227449, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 1092663, 'from_messages': 29}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 257817, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 257817, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 3486, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 178980, 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 182466, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 4046157, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 477, 'total_stock_value': 5243487, 'to_messages': 566, 'shared_receipt_with_poi': 465, 'restricted_stock': 1757552, 'from_poi_to_this_person': 39, 'restricted_stock_deferred': -560222, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 56301, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': -5104, 'other': 864523, 'total_payments': 916197, 'from_messages': 29}, {'long_term_incentive': 554422, 'exercised_stock_options': 1362375, 'bonus': 100000, 'director_fees': 'NaN', 'salary': 162779, 'total_stock_value': 1362375, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 181993, 'deferred_income': 'NaN', 'other': 162, 'total_payments': 999356, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 28798, 'bonus': 300000, 'director_fees': 'NaN', 'salary': 655037, 'total_stock_value': 28798, 'to_messages': 898, 'shared_receipt_with_poi': 728, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 7, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 400000, 'expenses': 31653, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 1386690, 'from_messages': 67}, {'long_term_incentive': 75000, 'exercised_stock_options': 'NaN', 'bonus': 300000, 'director_fees': 'NaN', 'salary': 261809, 'total_stock_value': 'NaN', 'to_messages': 312, 'shared_receipt_with_poi': 196, 'restricted_stock': 307301, 'from_poi_to_this_person': 29, 'restricted_stock_deferred': -307301, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 7, 'deferral_payments': 'NaN', 'deferred_income': -159792, 'other': 540, 'total_payments': 477557, 'from_messages': 15}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 47304, 'to_messages': 58, 'shared_receipt_with_poi': 3, 'restricted_stock': 47304, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 1, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 16}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 7509039, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 96840, 'total_stock_value': 7890324, 'to_messages': 1671, 'shared_receipt_with_poi': 1063, 'restricted_stock': 381285, 'from_poi_to_this_person': 204, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 14689, 'poi': False, 'from_this_person_to_poi': 49, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 111529, 'from_messages': 221}, {'long_term_incentive': 135836, 'exercised_stock_options': 5266578, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 94941, 'total_stock_value': 7307594, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 2041016, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 18834, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 176, 'total_payments': 249787, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 70000, 'director_fees': 'NaN', 'salary': 221003, 'total_stock_value': 'NaN', 'to_messages': 176, 'shared_receipt_with_poi': 114, 'restricted_stock': 'NaN', 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 28164, 'poi': False, 'from_this_person_to_poi': 3, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 774, 'total_payments': 319941, 'from_messages': 14}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 192758, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 192758, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 55097, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 55097, 'from_messages': 'NaN'}, {'long_term_incentive': 200000, 'exercised_stock_options': 4452476, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 222093, 'total_stock_value': 4817796, 'to_messages': 266, 'shared_receipt_with_poi': 73, 'restricted_stock': 365320, 'from_poi_to_this_person': 0, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 46145, 'poi': False, 'from_this_person_to_poi': 0, 'deferral_payments': 16586, 'deferred_income': 'NaN', 'other': 426629, 'total_payments': 911453, 'from_messages': 41}, {'long_term_incentive': 369721, 'exercised_stock_options': 1465734, 'bonus': 1000000, 'director_fees': 'NaN', 'salary': 213625, 'total_stock_value': 1843816, 'to_messages': 1607, 'shared_receipt_with_poi': 1336, 'restricted_stock': 378082, 'from_poi_to_this_person': 23, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 38559, 'poi': False, 'from_this_person_to_poi': 8, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 425688, 'total_payments': 2047593, 'from_messages': 40}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 664375, 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 758931, 'to_messages': 1433, 'shared_receipt_with_poi': 508, 'restricted_stock': 94556, 'from_poi_to_this_person': 25, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 2, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 'NaN', 'total_payments': 'NaN', 'from_messages': 215}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 36666, 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 228656, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -36666, 'other': 'NaN', 'total_payments': 228656, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 185063, 'bonus': 250000, 'director_fees': 'NaN', 'salary': 288558, 'total_stock_value': 725735, 'to_messages': 258, 'shared_receipt_with_poi': 117, 'restricted_stock': 540672, 'from_poi_to_this_person': 25, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 10181, 'poi': False, 'from_this_person_to_poi': 19, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 2435, 'total_payments': 551174, 'from_messages': 56}, {'long_term_incentive': 375304, 'exercised_stock_options': 636246, 'bonus': 850000, 'director_fees': 'NaN', 'salary': 231946, 'total_stock_value': 896153, 'to_messages': 209, 'shared_receipt_with_poi': 178, 'restricted_stock': 259907, 'from_poi_to_this_person': 10, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 48405, 'poi': False, 'from_this_person_to_poi': 27, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 60814, 'total_payments': 1566469, 'from_messages': 44}, {'long_term_incentive': 256191, 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 63744, 'total_stock_value': 384930, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 384930, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 51870, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -10800, 'other': 401130, 'total_payments': 762135, 'from_messages': 'NaN'}, {'long_term_incentive': 150000, 'exercised_stock_options': 187500, 'bonus': 700000, 'director_fees': 'NaN', 'salary': 262663, 'total_stock_value': 668132, 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 480632, 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 48357, 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': -280000, 'other': 416441, 'total_payments': 1297461, 'from_messages': 'NaN'}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 607837, 'bonus': 650000, 'director_fees': 'NaN', 'salary': 269076, 'total_stock_value': 987001, 'to_messages': 15149, 'shared_receipt_with_poi': 4527, 'restricted_stock': 379164, 'from_poi_to_this_person': 74, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 137767, 'poi': False, 'from_this_person_to_poi': 65, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 705, 'total_payments': 1057548, 'from_messages': 1215}, {'long_term_incentive': 1294981, 'exercised_stock_options': 2291113, 'bonus': 3000000, 'director_fees': 'NaN', 'salary': 365163, 'total_stock_value': 3614261, 'to_messages': 3093, 'shared_receipt_with_poi': 2097, 'restricted_stock': 1323148, 'from_poi_to_this_person': 66, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 86174, 'poi': True, 'from_this_person_to_poi': 609, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 1661, 'total_payments': 4747979, 'from_messages': 3069}, {'long_term_incentive': 'NaN', 'exercised_stock_options': 'NaN', 'bonus': 'NaN', 'director_fees': 'NaN', 'salary': 'NaN', 'total_stock_value': 'NaN', 'to_messages': 'NaN', 'shared_receipt_with_poi': 'NaN', 'restricted_stock': 'NaN', 'from_poi_to_this_person': 'NaN', 'restricted_stock_deferred': 'NaN', 'email_address': 'NaN', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 'NaN', 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 362096, 'total_payments': 362096, 'from_messages': 'NaN'}, {'long_term_incentive': 484000, 'exercised_stock_options': 8831913, 'bonus': 800000, 'director_fees': 'NaN', 'salary': 492375, 'total_stock_value': 8831913, 'to_messages': 2181, 'shared_receipt_with_poi': 1401, 'restricted_stock': 1787380, 'from_poi_to_this_person': 64, 'restricted_stock_deferred': -1787380, 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 51124, 'poi': False, 'from_this_person_to_poi': 20, 'deferral_payments': 'NaN', 'deferred_income': -1284000, 'other': 7482, 'total_payments': 550981, 'from_messages': 909}, {'long_term_incentive': 476451, 'exercised_stock_options': 'NaN', 'bonus': 700000, 'director_fees': 'NaN', 'salary': 257486, 'total_stock_value': 698920, 'to_messages': 2647, 'shared_receipt_with_poi': 2565, 'restricted_stock': 698920, 'from_poi_to_this_person': 37, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 'NaN', 'poi': False, 'from_this_person_to_poi': 13, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 111122, 'total_payments': 1545059, 'from_messages': 38}, {'long_term_incentive': 556416, 'exercised_stock_options': 1550019, 'bonus': 600000, 'director_fees': 'NaN', 'salary': 250100, 'total_stock_value': 1865087, 'to_messages': 2572, 'shared_receipt_with_poi': 1902, 'restricted_stock': 315068, 'from_poi_to_this_person': 305, 'restricted_stock_deferred': 'NaN', 'email_address': '[email protected]', 'loan_advances': 'NaN', 'expenses': 3475, 'poi': False, 'from_this_person_to_poi': 14, 'deferral_payments': 'NaN', 'deferred_income': 'NaN', 'other': 473, 'total_payments': 1410464, 'from_messages': 63}])" | |
}, | |
"execution_count": 43, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#Number of items in the dictionary\nlen(enron_data)", | |
"execution_count": 44, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "146" | |
}, | |
"execution_count": 44, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# Number of features in the dict\n\nunique_features = set(\n feature\n for row_dict in enron_data.values()\n for feature in row_dict.keys()\n)\nprint(unique_features)\n# {'golf', 'delta', 'foxtrot', 'alpha', 'bravo', 'echo', 'tango', 'kilo'}\nprint(len(unique_features))\n# 8\n", | |
"execution_count": 45, | |
"outputs": [ | |
{ | |
"text": "{'exercised_stock_options', 'long_term_incentive', 'bonus', 'salary', 'total_stock_value', 'restricted_stock_deferred', 'to_messages', 'shared_receipt_with_poi', 'restricted_stock', 'email_address', 'loan_advances', 'deferral_payments', 'expenses', 'poi', 'from_this_person_to_poi', 'from_messages', 'from_poi_to_this_person', 'deferred_income', 'total_payments', 'other', 'director_fees'}\n21\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# Listing out individual elements from the dictionary\nlist(enron_data.values())[1]", | |
"execution_count": 46, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "{'bonus': 750000,\n 'deferral_payments': 'NaN',\n 'deferred_income': 'NaN',\n 'director_fees': 'NaN',\n 'email_address': '[email protected]',\n 'exercised_stock_options': 436515,\n 'expenses': 'NaN',\n 'from_messages': 'NaN',\n 'from_poi_to_this_person': 'NaN',\n 'from_this_person_to_poi': 'NaN',\n 'loan_advances': 'NaN',\n 'long_term_incentive': 304805,\n 'other': 819288,\n 'poi': False,\n 'restricted_stock': 441096,\n 'restricted_stock_deferred': 'NaN',\n 'salary': 272880,\n 'shared_receipt_with_poi': 'NaN',\n 'to_messages': 'NaN',\n 'total_payments': 2146973,\n 'total_stock_value': 877611}" | |
}, | |
"execution_count": 46, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# Read poi names\npoi_names = pd.read_csv(\"./enron/ud120-projects-master/final_project/poi_names.txt\")\n", | |
"execution_count": 47, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "poi_names.head()", | |
"execution_count": 48, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": " http://usatoday30.usatoday.com/money/industries/energy/2005-12-28-enron-participants_x.htm\n(y) Lay Kenneth \n(y) Skilling Jeffrey \n(n) Howard Kevin \n(n) Krautz Michael \n(n) Yeager Scott ", | |
"text/html": "<div>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>http://usatoday30.usatoday.com/money/industries/energy/2005-12-28-enron-participants_x.htm</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>(y) Lay</th>\n <td>Kenneth</td>\n </tr>\n <tr>\n <th>(y) Skilling</th>\n <td>Jeffrey</td>\n </tr>\n <tr>\n <th>(n) Howard</th>\n <td>Kevin</td>\n </tr>\n <tr>\n <th>(n) Krautz</th>\n <td>Michael</td>\n </tr>\n <tr>\n <th>(n) Yeager</th>\n <td>Scott</td>\n </tr>\n </tbody>\n</table>\n</div>" | |
}, | |
"execution_count": 48, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "keys = enron_data.keys()", | |
"execution_count": 49, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "type(enron_data)", | |
"execution_count": 50, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "dict" | |
}, | |
"execution_count": 50, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data['SKILLING JEFFREY K']['poi']", | |
"execution_count": 51, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "True" | |
}, | |
"execution_count": 51, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# How many POIs in the dataset?\ncount = 0\nfor user in enron_data:\n if enron_data[user]['poi'] == True:\n count+=1\nprint (count)", | |
"execution_count": 52, | |
"outputs": [ | |
{ | |
"text": "18\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# %load ./enron/ud120-projects-master/final_project/poi_email_addresses.py\ndef poiEmails():\n email_list = [\"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\"\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"joe'.'[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"kevin'.'[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"ken'.'[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"'[email protected]\", \n \"[email protected]\", \n \"'david.delainey'@enron.com\", \n \"[email protected]\", \n \"delainey'.'[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"ben'.'[email protected]\",\n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"lawyer'.'[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\", \n \"'[email protected]\",\n \"[email protected]\",\n \"[email protected]\",\n \"[email protected]\", \n \"[email protected]\"\n ]\n return email_list\n", | |
"execution_count": 53, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "len(poiEmails())", | |
"execution_count": 54, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "90" | |
}, | |
"execution_count": 54, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# %load ./enron/ud120-projects-master/final_project/poi_names.txt\nhttp://usatoday30.usatoday.com/money/industries/energy/2005-12-28-enron-participants_x.htm\n\n(y) Lay, Kenneth\n(y) Skilling, Jeffrey\n(n) Howard, Kevin\n(n) Krautz, Michael\n(n) Yeager, Scott\n(n) Hirko, Joseph\n(n) Shelby, Rex\n(n) Bermingham, David\n(n) Darby, Giles\n(n) Mulgrew, Gary\n(n) Bayley, Daniel\n(n) Brown, James\n(n) Furst, Robert\n(n) Fuhs, William\n(n) Causey, Richard\n(n) Calger, Christopher\n(n) DeSpain, Timothy\n(n) Hannon, Kevin\n(n) Koenig, Mark\n(y) Forney, John\n(n) Rice, Kenneth\n(n) Rieker, Paula\n(n) Fastow, Lea\n(n) Fastow, Andrew\n(y) Delainey, David\n(n) Glisan, Ben\n(n) Richter, Jeffrey\n(n) Lawyer, Larry\n(n) Belden, Timothy\n(n) Kopper, Michael\n(n) Duncan, David\n(n) Bowen, Raymond\n(n) Colwell, Wesley\n(n) Boyle, Dan\n(n) Loehr, Christopher\n", | |
"execution_count": 55, | |
"outputs": [ | |
{ | |
"ename": "SyntaxError", | |
"traceback": [ | |
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-55-e1c26120c9de>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m http://usatoday30.usatoday.com/money/industries/energy/2005-12-28-enron-participants_x.htm\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" | |
], | |
"output_type": "error", | |
"evalue": "invalid syntax (<ipython-input-55-e1c26120c9de>, line 2)" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "len(poi_names)", | |
"execution_count": 56, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "35" | |
}, | |
"execution_count": 56, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "list(enron_data.keys())", | |
"execution_count": 57, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "['SCRIMSHAW MATTHEW',\n 'GOLD JOSEPH',\n 'HAYES ROBERT E',\n 'KOPPER MICHAEL J',\n 'MULLER MARK S',\n 'PAI LOU L',\n 'BELFER ROBERT',\n 'POWERS WILLIAM',\n 'PIPER GREGORY F',\n 'FASTOW ANDREW S',\n 'BLACHMAN JEREMY M',\n 'IZZO LAWRENCE L',\n 'MCCLELLAN GEORGE',\n 'BELDEN TIMOTHY N',\n 'BERGSIEKER RICHARD P',\n 'GATHMANN WILLIAM D',\n 'BOWEN JR RAYMOND M',\n 'NOLES JAMES L',\n 'LEMAISTRE CHARLES',\n 'WHALEY DAVID A',\n 'TOTAL',\n 'WROBEL BRUCE',\n 'GLISAN JR BEN F',\n 'LEWIS RICHARD',\n 'BUY RICHARD B',\n 'WAKEHAM JOHN',\n 'MEYER JEROME J',\n 'DETMERING TIMOTHY J',\n 'LEFF DANIEL P',\n 'COX DAVID',\n 'BLAKE JR. NORMAN P',\n 'KOENIG MARK E',\n 'MCDONALD REBECCA',\n 'BAY FRANKLIN R',\n 'MENDELSOHN JOHN',\n 'GAHN ROBERT S',\n 'KAMINSKI WINCENTY J',\n 'UMANOFF ADAM S',\n 'BUTTS ROBERT H',\n 'COLWELL WESLEY',\n 'KITCHEN LOUISE',\n 'JAEDICKE ROBERT',\n 'REYNOLDS LAWRENCE',\n 'DEFFNER JOSEPH M',\n 'PRENTICE JAMES',\n 'OLSON CINDY K',\n 'WHITE JR THOMAS E',\n 'MORAN MICHAEL P',\n 'CUMBERLAND MICHAEL S',\n 'SAVAGE FRANK',\n 'HUMPHREY GENE E',\n 'ELLIOTT STEVEN',\n 'SKILLING JEFFREY K',\n 'FALLON JAMES B',\n 'FREVERT MARK A',\n 'MCMAHON JEFFREY',\n 'HIRKO JOSEPH',\n 'DONAHUE JR JEFFREY M',\n 'BUCHANAN HAROLD G',\n 'HAEDICKE MARK E',\n 'SHELBY REX',\n 'FOWLER PEGGY',\n 'RIEKER PAULA H',\n 'WASAFF GEORGE',\n 'LAY KENNETH L',\n 'CHAN RONNIE',\n 'BROWN MICHAEL',\n 'KISHKILL JOSEPH G',\n 'WALLS JR ROBERT H',\n 'GILLIS JOHN',\n 'GRAMM WENDY L',\n 'SHANKMAN JEFFREY A',\n 'METTS MARK',\n 'MCCONNELL MICHAEL S',\n 'BECK SALLY W',\n 'BERBERIAN DAVID',\n 'DUNCAN JOHN H',\n 'CLINE KENNETH W',\n 'WHALLEY LAWRENCE G',\n 'PEREIRA PAULO V. FERRAZ',\n 'BAZELIDES PHILIP J',\n 'FUGH JOHN L',\n 'YEAGER F SCOTT',\n 'MORDAUNT KRISTINA M',\n 'HAUG DAVID L',\n 'HICKERSON GARY J',\n 'HORTON STANLEY C',\n 'WODRASKA JOHN',\n 'TILNEY ELIZABETH A',\n 'RICE KENNETH D',\n 'CALGER CHRISTOPHER F',\n 'WALTERS GARETH W',\n 'STABLER FRANK',\n 'FOY JOE',\n 'HUGHES JAMES A',\n 'BHATNAGAR SANJAY',\n 'WINOKUR JR. HERBERT S',\n 'CAUSEY RICHARD A',\n 'HAYSLETT RODERICK J',\n 'CHRISTODOULOU DIOMEDES',\n 'MEYER ROCKFORD G',\n 'KEAN STEVEN J',\n 'ALLEN PHILLIP K',\n 'CORDES WILLIAM R',\n 'SHERRICK JEFFREY B',\n 'DURAN WILLIAM D',\n 'GRAY RODNEY',\n 'LINDHOLM TOD A',\n 'MARTIN AMANDA K',\n 'BAXTER JOHN C',\n 'MURRAY JULIA H',\n 'SHERRIFF JOHN R',\n 'GIBBS DANA R',\n 'SHARP VICTORIA T',\n 'LOCKHART EUGENE E',\n 'LOWRY CHARLES P',\n 'FITZGERALD JAY L',\n 'DIMICHELE RICHARD G',\n 'LAVORATO JOHN J',\n 'HANNON KEVIN P',\n 'ECHOLS JOHN B',\n 'TAYLOR MITCHELL S',\n 'BADUM JAMES P',\n 'BANNANTINE JAMES M',\n 'SULLIVAN-SHAKLOVITZ COLLEEN',\n 'PICKERING MARK R',\n 'CARTER REBECCA C',\n 'PIRO JIM',\n 'REDMOND BRIAN L',\n 'OVERDYKE JR JERE C',\n 'DODSON KEITH',\n 'YEAP SOON',\n 'THORN TERENCE H',\n 'BIBI PHILIPPE A',\n 'MCCARTY DANNY J',\n 'URQUHART JOHN A',\n 'JACKSON CHARLENE R',\n 'GARLAND C KEVIN',\n 'WESTFAHL RICHARD K',\n 'HERMANN ROBERT J',\n 'SHAPIRO RICHARD S',\n 'DELAINEY DAVID W',\n 'THE TRAVEL AGENCY IN THE PARK',\n 'DERRICK JR. JAMES V',\n 'SUNDE MARTIN',\n 'DIETRICH JANET R']" | |
}, | |
"execution_count": 57, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# total stock belonging to James Prentice\nenron_data['PRENTICE JAMES']['total_stock_value']", | |
"execution_count": 58, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "1095040" | |
}, | |
"execution_count": 58, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data['PRENTICE JAMES']", | |
"execution_count": 59, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "{'bonus': 'NaN',\n 'deferral_payments': 564348,\n 'deferred_income': 'NaN',\n 'director_fees': 'NaN',\n 'email_address': '[email protected]',\n 'exercised_stock_options': 886231,\n 'expenses': 'NaN',\n 'from_messages': 'NaN',\n 'from_poi_to_this_person': 'NaN',\n 'from_this_person_to_poi': 'NaN',\n 'loan_advances': 'NaN',\n 'long_term_incentive': 'NaN',\n 'other': 'NaN',\n 'poi': False,\n 'restricted_stock': 208809,\n 'restricted_stock_deferred': 'NaN',\n 'salary': 'NaN',\n 'shared_receipt_with_poi': 'NaN',\n 'to_messages': 'NaN',\n 'total_payments': 564348,\n 'total_stock_value': 1095040}" | |
}, | |
"execution_count": 59, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#Find num of emails Wesley Colwell sent to poi\nenron_data['COLWELL WESLEY']['from_this_person_to_poi']", | |
"execution_count": 60, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "11" | |
}, | |
"execution_count": 60, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# Stock options excercised by Jeffrey K Skilling\nenron_data['SKILLING JEFFREY K']['exercised_stock_options']", | |
"execution_count": 61, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "19250000" | |
}, | |
"execution_count": 61, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### Who took home the most money ? " | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data['LAY KENNETH L']['total_payments']", | |
"execution_count": 62, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "103559793" | |
}, | |
"execution_count": 62, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data['SKILLING JEFFREY K']['total_payments']", | |
"execution_count": 63, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "8682716" | |
}, | |
"execution_count": 63, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "enron_data['FASTOW ANDREW S']['total_payments']", | |
"execution_count": 64, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "2424083" | |
}, | |
"execution_count": 64, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#How many folks in this dataset have a quantified salary? What about a known email address?\ncount_salary = 0\ncount_email = 0\nfor user in enron_data:\n if enron_data[user]['salary'] != 'NaN':\n #email[user] = enron_data[user]['email_address']\n count_salary+=1\nprint (count_salary)\n\nfor user in enron_data:\n if enron_data[user]['email_address'] != 'NaN':\n count_email+=1\nprint (count_email)", | |
"execution_count": 65, | |
"outputs": [ | |
{ | |
"text": "95\n111\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#How many people in the E+F dataset (as it currently exists) have “NaN” for their total payments? \n#What percentage of people in the dataset as a whole is this?\n\ncount = 0\n#count_email = 0\nfor user in enron_data:\n if enron_data[user]['total_payments'] == 'NaN':\n #email[user] = enron_data[user]['email_address']\n count+=1\nprint (count)\n", | |
"execution_count": 67, | |
"outputs": [ | |
{ | |
"text": "21\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "count*100/len(enron_data)", | |
"execution_count": 68, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "14.383561643835616" | |
}, | |
"execution_count": 68, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Mission POI" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# %load ./enron/ud120-projects-master/tools/feature_format.py\n#!/usr/bin/python\n\n\"\"\" \n A general tool for converting data from the\n dictionary format to an (n x k) python list that's \n ready for training an sklearn algorithm\n\n n--no. of key-value pairs in dictonary\n k--no. of features being extracted\n\n dictionary keys are names of persons in dataset\n dictionary values are dictionaries, where each\n key-value pair in the dict is the name\n of a feature, and its value for that person\n\n In addition to converting a dictionary to a numpy \n array, you may want to separate the labels from the\n features--this is what targetFeatureSplit is for\n\n so, if you want to have the poi label as the target,\n and the features you want to use are the person's\n salary and bonus, here's what you would do:\n\n feature_list = [\"poi\", \"salary\", \"bonus\"] \n data_array = featureFormat( data_dictionary, feature_list )\n label, features = targetFeatureSplit(data_array)\n\n the line above (targetFeatureSplit) assumes that the\n label is the _first_ item in feature_list--very important\n that poi is listed first!\n\"\"\"\n\n\nimport numpy as np\n\ndef featureFormat( dictionary, features, remove_NaN=True, remove_all_zeroes=True, remove_any_zeroes=False, sort_keys = False):\n \"\"\" convert dictionary to numpy array of features\n remove_NaN = True will convert \"NaN\" string to 0.0\n remove_all_zeroes = True will omit any data points for which\n all the features you seek are 0.0\n remove_any_zeroes = True will omit any data points for which\n any of the features you seek are 0.0\n sort_keys = True sorts keys by alphabetical order. Setting the value as\n a string opens the corresponding pickle file with a preset key\n order (this is used for Python 3 compatibility, and sort_keys\n should be left as False for the course mini-projects).\n NOTE: first feature is assumed to be 'poi' and is not checked for\n removal for zero or missing values.\n \"\"\"\n\n\n return_list = []\n\n # Key order - first branch is for Python 3 compatibility on mini-projects,\n # second branch is for compatibility on final project.\n if isinstance(sort_keys, str):\n import pickle\n keys = pickle.load(open(sort_keys, \"rb\"))\n elif sort_keys:\n keys = sorted(dictionary.keys())\n else:\n keys = dictionary.keys()\n\n for key in keys:\n tmp_list = []\n for feature in features:\n try:\n dictionary[key][feature]\n except KeyError:\n print \"error: key \", feature, \" not present\"\n return\n value = dictionary[key][feature]\n if value==\"NaN\" and remove_NaN:\n value = 0\n tmp_list.append( float(value) )\n\n # Logic for deciding whether or not to add the data point.\n append = True\n # exclude 'poi' class as criteria.\n if features[0] == 'poi':\n test_list = tmp_list[1:]\n else:\n test_list = tmp_list\n ### if all features are zero and you want to remove\n ### data points that are all zero, do that here\n if remove_all_zeroes:\n append = False\n for item in test_list:\n if item != 0 and item != \"NaN\":\n append = True\n break\n ### if any features for a given data point are zero\n ### and you want to remove data points with any zeroes,\n ### handle that here\n if remove_any_zeroes:\n if 0 in test_list or \"NaN\" in test_list:\n append = False\n ### Append the data point if flagged for addition.\n if append:\n return_list.append( np.array(tmp_list) )\n\n return np.array(return_list)\n\n\ndef targetFeatureSplit( data ):\n \"\"\" \n given a numpy array like the one returned from\n featureFormat, separate out the first feature\n and put it into its own list (this should be the \n quantity you want to predict)\n\n return targets and features as separate lists\n\n (sklearn can generally handle both lists and numpy arrays as \n input formats when training/predicting)\n \"\"\"\n\n target = []\n features = []\n for item in data:\n target.append( item[0] )\n features.append( item[1:] )\n\n return target, features\n\n\n\n\n", | |
"execution_count": 69, | |
"outputs": [ | |
{ | |
"ename": "SyntaxError", | |
"traceback": [ | |
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-69-dbdbefe89349>\"\u001b[1;36m, line \u001b[1;32m71\u001b[0m\n\u001b[1;33m print \"error: key \", feature, \" not present\"\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m Missing parentheses in call to 'print'\n" | |
], | |
"output_type": "error", | |
"evalue": "Missing parentheses in call to 'print' (<ipython-input-69-dbdbefe89349>, line 71)" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "#How many POIs in the E+F dataset have “NaN” for their total payments? What percentage of POI’s as a whole is this?\ncount_NaN_tp = 0\nfor key in enron_data.keys():\n if enron_data[key]['total_payments'] == 'NaN' and enron_data[key]['poi'] == True :\n count_NaN_tp+=1\nprint(count_NaN_tp)\nprint(float(count_NaN_tp)/len(enron_data.keys()))", | |
"execution_count": 70, | |
"outputs": [ | |
{ | |
"text": "0\n0.0\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"collapsed": true | |
}, | |
"cell_type": "markdown", | |
"source": "# Data Modeling" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "from sklearn import datasets\nfrom sklearn.svm import SVC\nfrom sklearn import cross_validation\n\n\niris = datasets.load_iris()\nfeatures = iris.data\nlabels = iris.target", | |
"execution_count": 71, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "features.shape, labels.shape", | |
"execution_count": 72, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "((150, 4), (150,))" | |
}, | |
"execution_count": 72, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "features_train, features_test, labels_train, labels_test = cross_validation.train_test_split(features, labels, test_size=0.4, random_state=0)", | |
"execution_count": 73, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "clf = SVC(kernel=\"linear\", C=1.)\nclf.fit(features_train, labels_train)\n\nprint(clf.score(features_test, labels_test))", | |
"execution_count": 74, | |
"outputs": [ | |
{ | |
"text": "0.966666666667\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### Evaluate accuracy on Titanic data" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nimport pandas as pd\n\n# Load the dataset\nX = pd.read_csv('titanic_data.csv')\n# Limit to numeric data\nX = X._get_numeric_data()\n# Separate the labels\ny = X['Survived']\n# Remove labels from the inputs, and age due to missing data\ndel X['Age'], X['Survived']\n\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn import cross_validation\n", | |
"execution_count": 75, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "y.head()", | |
"execution_count": 76, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "0 0\n1 1\n2 1\n3 1\n4 0\nName: Survived, dtype: int64" | |
}, | |
"execution_count": 76, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "\n# TODO: split the data into training and testing sets,\n# using the standard settings for train_test_split.\n# Then, train and test the classifiers with your newly split data instead of X and y.\n\nX_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.4, random_state=0)\n\n", | |
"execution_count": 77, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# The decision tree classifier\nclf1 = DecisionTreeClassifier()\nclf1.fit(X_train,y_train)\nprint(\"Decision Tree has accuracy: \",accuracy_score(clf1.predict(X_test),y_test))\n", | |
"execution_count": 78, | |
"outputs": [ | |
{ | |
"text": "Decision Tree has accuracy: 0.666666666667\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# The naive Bayes classifier\nclf2 = GaussianNB()\nclf2.fit(X_train,y_train)\nprint(\"GaussianNB has accuracy: \",accuracy_score(clf2.predict(X_test),y_test))\n\nanswer = { \n \"Naive Bayes Score\": 0, \n \"Decision Tree Score\": 0\n}", | |
"execution_count": 79, | |
"outputs": [ | |
{ | |
"text": "GaussianNB has accuracy: 0.672268907563\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "answer", | |
"execution_count": 80, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "{'Decision Tree Score': 0, 'Naive Bayes Score': 0}" | |
}, | |
"execution_count": 80, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "from sklearn.metrics import confusion_matrix", | |
"execution_count": 81, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "confusion_matrix(clf1.predict(X_test),y_test)", | |
"execution_count": 82, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "array([[170, 68],\n [ 51, 68]])" | |
}, | |
"execution_count": 82, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "confusion_matrix(clf2.predict(X_test),y_test)", | |
"execution_count": 83, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": "array([[188, 84],\n [ 33, 52]])" | |
}, | |
"execution_count": 83, | |
"output_type": "execute_result", | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# In this exercise, we'll use the Titanic dataset as before, train two classifiers and\n# look at their confusion matrices. Your job is to create a train/test split in the data\n# and report the results in the dictionary at the bottom.\n\nimport numpy as np\nimport pandas as pd\n\n# Load the dataset\nfrom sklearn import datasets\n\nX = pd.read_csv('titanic_data.csv')\n\nX = X._get_numeric_data()\ny = X['Survived']\ndel X['Age'], X['Survived']\n\n\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import confusion_matrix\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn import cross_validation\n\n\n# TODO: split the data into training and testing sets,\n# using the default settings for train_test_split (or test_size = 0.25 if specified).\n# Then, train and test the classifiers with your newly split data instead of X and y.\n\nX_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=0)\n\nclf1 = DecisionTreeClassifier()\nclf1.fit(X_train,y_train)\nprint(\"Confusion matrix for this Decision Tree:\\n\",confusion_matrix(clf1.predict(X_test),y_test))\n\nclf2 = GaussianNB()\nclf2.fit(X_train,y_train)\nprint(\"GaussianNB confusion matrix:\\n\",confusion_matrix(clf2.predict(X_test),y_test))\n\n#TODO: store the confusion matrices on the test sets below\n\nconfusions = {\n \"Naive Bayes\": np.matrix('99,37; 40 47'),\n \"Decision Tree\": np.matrix('122 48; 17 36')\n}", | |
"execution_count": 84, | |
"outputs": [ | |
{ | |
"text": "Confusion matrix for this Decision Tree:\n [[101 38]\n [ 38 46]]\nGaussianNB confusion matrix:\n [[122 48]\n [ 17 36]]\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Precision and Recall " | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# As with the previous exercises, let's look at the performance of a couple of classifiers\n# on the familiar Titanic dataset. Add a train/test split, then store the results in the\n# dictionary provided.\n\nimport numpy as np\nimport pandas as pd\n\n# Load the dataset\nX = pd.read_csv('titanic_data.csv')\n\nX = X._get_numeric_data()\ny = X['Survived']\ndel X['Age'], X['Survived']\n\n\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import recall_score as recall\nfrom sklearn.metrics import precision_score as precision\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn import cross_validation\n\n# TODO: split the data into training and testing sets,\n# using the standard settings for train_test_split.\n# Then, train and test the classifiers with your newly split data instead of X and y.\nX_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=0)\n\nclf1 = DecisionTreeClassifier()\nclf1.fit(X_train, y_train)\nprint(\"Decision Tree recall: {:.2f} and precision: {:.2f}\".format(recall(y_test,clf1.predict(X_test)),precision(y_test,clf1.predict(X_test))))\n\nclf2 = GaussianNB()\nclf2.fit(X_train, y_train)\nprint(\"GaussianNB recall: {:.2f} and precision: {:.2f}\".format(recall(y_test,clf2.predict(X_test)),precision(y_test,clf2.predict(X_test))))\n\nresults = {\n \"Naive Bayes Recall\": 0.43,\n \"Naive Bayes Precision\": 0.56,\n \"Decision Tree Recall\": 0.56,\n \"Decision Tree Precision\": 0.56\n}", | |
"execution_count": 85, | |
"outputs": [ | |
{ | |
"text": "Decision Tree recall: 0.54 and precision: 0.56\nGaussianNB recall: 0.43 and precision: 0.68\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# F1 score" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "# As usual, use a train/test split to get a reliable F1 score from two classifiers, and\n# save it the scores in the provided dictionaries.\n\nimport numpy as np\nimport pandas as pd\n\n# Load the dataset\nX = pd.read_csv('titanic_data.csv')\n\nX = X._get_numeric_data()\ny = X['Survived']\ndel X['Age'], X['Survived']\n\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import f1_score\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn import cross_validation\n\n# TODO: split the data into training and testing sets,\n# using the standard settings for train_test_split.\n# Then, train and test the classifiers with your newly split data instead of X and y.\n\nX_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=0)\n\nclf1 = DecisionTreeClassifier()\nclf1.fit(X_train, y_train)\nprint(\"Decision Tree F1 score: {:.2f}\".format(f1_score(y_test, clf1.predict(X_test))))\n\nclf2 = GaussianNB()\nclf2.fit(X_train, y_train)\nprint(\"GaussianNB F1 score: {:.2f}\".format(f1_score(y_test, clf2.predict(X_test))))\n\nF1_scores = {\n \"Naive Bayes\": 0.53,\n \"Decision Tree\": 0.55\n}", | |
"execution_count": 86, | |
"outputs": [ | |
{ | |
"text": "Decision Tree F1 score: 0.55\nGaussianNB F1 score: 0.53\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# Mean absolute and squared error" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np\nimport pandas as pd\n\n# Load the dataset\nfrom sklearn.datasets import load_linnerud\n\nlinnerud_data = load_linnerud()\nX = linnerud_data.data\ny = linnerud_data.target\n\nfrom sklearn.tree import DecisionTreeRegressor\nfrom sklearn.metrics import mean_absolute_error as mae\nfrom sklearn.metrics import mean_squared_error as mse\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn import cross_validation\n\n# TODO: split the data into training and testing sets,\n# using the standard settings for train_test_split.\n# Then, train and test the classifiers with your newly split data instead of X and y.\nX_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=0)\n\nreg1 = DecisionTreeRegressor()\nreg1.fit(X_train, y_train)\nprint(\"Decision Tree mean absolute error: {:.2f}\".format(mae(y_test,reg1.predict(X_test))))\n\nreg2 = LinearRegression()\nreg2.fit(X_train, y_train)\nprint(\"Linear regression mean absolute error: {:.2f}\".format(mae(y_test,reg2.predict(X_test))))\n\nreg3 = DecisionTreeRegressor()\nreg3.fit(X_train, y_train)\nprint(\"Decision Tree mean absolute error: {:.2f}\".format(mse(y_test, reg3.predict(X_test))))\n\nreg4 = LinearRegression()\nreg4.fit(X_train, y_train)\nprint(\"Linear regression mean absolute error: {:.2f}\".format(mse(y_test, reg4.predict(X_test))))\n\nresults = {\n \"MAE Linear Regression\": 11.45,\n \"MAE Decision Tree\": 5.47,\n \"MSE Linear Regression\": 380.46,\n \"MSE Decision Tree\": 93.52\n\n}", | |
"execution_count": 87, | |
"outputs": [ | |
{ | |
"text": "Decision Tree mean absolute error: 8.60\nLinear regression mean absolute error: 11.45\nDecision Tree mean absolute error: 1132.80\nLinear regression mean absolute error: 380.46\n", | |
"name": "stdout", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "", | |
"execution_count": null, | |
"outputs": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3", | |
"language": "python" | |
}, | |
"language_info": { | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"file_extension": ".py", | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"version": "3.5.1", | |
"name": "python", | |
"mimetype": "text/x-python" | |
}, | |
"gist_id": "8e2ebee37c8e7aaa10fd48acef1e5e52" | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment