Skip to content

Instantly share code, notes, and snippets.

@erood
Created October 20, 2016 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erood/16f20eb13c36c9079d7bf0c4dbd49bfc to your computer and use it in GitHub Desktop.
Save erood/16f20eb13c36c9079d7bf0c4dbd49bfc to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 188,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%matplotlib inline \n",
"import matplotlib.pyplot as plt \n",
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"import statsmodels.api as sm\n",
"from statsmodels.sandbox.regression.predstd import wls_prediction_std\n",
"\n",
"import plotly.plotly as py\n",
"import plotly.graph_objs as go\n",
"from plotly.tools import FigureFactory as FF\n",
"py.sign_in('erikrood','3eqsrype8v')"
]
},
{
"cell_type": "code",
"execution_count": 192,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"PE_data = pandas.read_csv('/Users/erikrood/desktop/Sector_Margins_10_15_16.csv') "
]
},
{
"cell_type": "code",
"execution_count": 193,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Symbol</th>\n",
" <th>Company Name</th>\n",
" <th>Security Type</th>\n",
" <th>Share price</th>\n",
" <th>P_E</th>\n",
" <th>EPS</th>\n",
" <th>P_E_calc</th>\n",
" <th>Security Price</th>\n",
" <th>EBITD Margin (TTM)</th>\n",
" <th>Market Capitalization</th>\n",
" <th>Market_cap_clean</th>\n",
" <th>Sector/Industry</th>\n",
" <th>Industry</th>\n",
" <th>Revenue (TTM, Thousands)</th>\n",
" <th>count</th>\n",
" <th>Revenue_clean</th>\n",
" <th>Profit to mkt cap</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EQIX</td>\n",
" <td>Equinix Inc</td>\n",
" <td>CSRT</td>\n",
" <td>360.25</td>\n",
" <td>403.10</td>\n",
" <td>0.89</td>\n",
" <td>404.78</td>\n",
" <td>351.2500</td>\n",
" <td>0.413642</td>\n",
" <td>$25.1B</td>\n",
" <td>$25,100,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3161.7770</td>\n",
" <td>1.0</td>\n",
" <td>$3,161,777.00</td>\n",
" <td>0.000052</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>NFLX</td>\n",
" <td>Netflix Inc</td>\n",
" <td>CS</td>\n",
" <td>101.47</td>\n",
" <td>315.17</td>\n",
" <td>0.32</td>\n",
" <td>317.09</td>\n",
" <td>104.8650</td>\n",
" <td>0.584791</td>\n",
" <td>$45B</td>\n",
" <td>$45,000,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>7624.6280</td>\n",
" <td>1.0</td>\n",
" <td>$7,624,628.00</td>\n",
" <td>0.000099</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>ALXN</td>\n",
" <td>Alexion Pharmaceuticals Inc</td>\n",
" <td>CS</td>\n",
" <td>118.34</td>\n",
" <td>299.70</td>\n",
" <td>0.39</td>\n",
" <td>303.44</td>\n",
" <td>125.1300</td>\n",
" <td>0.362509</td>\n",
" <td>$27.6B</td>\n",
" <td>$27,600,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>2821.6580</td>\n",
" <td>1.0</td>\n",
" <td>$2,821,658.00</td>\n",
" <td>0.000037</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>INCY</td>\n",
" <td>Incyte Corp</td>\n",
" <td>CS</td>\n",
" <td>87.10</td>\n",
" <td>256.82</td>\n",
" <td>0.34</td>\n",
" <td>256.18</td>\n",
" <td>97.9700</td>\n",
" <td>0.207029</td>\n",
" <td>$17.8B</td>\n",
" <td>$17,800,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>941.2430</td>\n",
" <td>1.0</td>\n",
" <td>$941,243.00</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>CRM</td>\n",
" <td>salesforce.com Inc</td>\n",
" <td>CS</td>\n",
" <td>74.27</td>\n",
" <td>239.30</td>\n",
" <td>0.31</td>\n",
" <td>239.58</td>\n",
" <td>70.9800</td>\n",
" <td>0.095010</td>\n",
" <td>$48.8B</td>\n",
" <td>$48,800,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Software</td>\n",
" <td>7474.5860</td>\n",
" <td>1.0</td>\n",
" <td>$7,474,586.00</td>\n",
" <td>0.000015</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>NEM</td>\n",
" <td>Newmont Mining Corp</td>\n",
" <td>CS</td>\n",
" <td>34.23</td>\n",
" <td>218.48</td>\n",
" <td>0.16</td>\n",
" <td>213.94</td>\n",
" <td>34.0300</td>\n",
" <td>0.368733</td>\n",
" <td>$18.1B</td>\n",
" <td>$18,100,000</td>\n",
" <td>Materials</td>\n",
" <td>Metals &amp; Mining</td>\n",
" <td>7919.0000</td>\n",
" <td>1.0</td>\n",
" <td>$7,919,000.00</td>\n",
" <td>0.000161</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>AMZN</td>\n",
" <td>Amazon.com Inc</td>\n",
" <td>CS</td>\n",
" <td>822.96</td>\n",
" <td>205.21</td>\n",
" <td>4.01</td>\n",
" <td>205.23</td>\n",
" <td>839.6500</td>\n",
" <td>0.092310</td>\n",
" <td>$398.9B</td>\n",
" <td>$398,900,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>120637.0000</td>\n",
" <td>1.0</td>\n",
" <td>$120,637,000.00</td>\n",
" <td>0.000028</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>IMO</td>\n",
" <td>Imperial Oil Ltd</td>\n",
" <td>CS</td>\n",
" <td>32.41</td>\n",
" <td>121.46</td>\n",
" <td>0.27</td>\n",
" <td>120.04</td>\n",
" <td>32.1700</td>\n",
" <td>0.083035</td>\n",
" <td>$27.6B</td>\n",
" <td>$27,600,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>17468.7855</td>\n",
" <td>1.0</td>\n",
" <td>$17,468,785.50</td>\n",
" <td>0.000053</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>ZBH</td>\n",
" <td>Zimmer Biomet Holdings Inc</td>\n",
" <td>CS</td>\n",
" <td>127.15</td>\n",
" <td>114.33</td>\n",
" <td>1.11</td>\n",
" <td>114.55</td>\n",
" <td>131.1600</td>\n",
" <td>0.393838</td>\n",
" <td>$26.1B</td>\n",
" <td>$26,100,000</td>\n",
" <td>Health Care</td>\n",
" <td>Health Care Equipment &amp; Supplies</td>\n",
" <td>7533.8000</td>\n",
" <td>1.0</td>\n",
" <td>$7,533,800.00</td>\n",
" <td>0.000114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>SE</td>\n",
" <td>Spectra Energy Corp</td>\n",
" <td>CS</td>\n",
" <td>42.55</td>\n",
" <td>99.84</td>\n",
" <td>0.43</td>\n",
" <td>98.95</td>\n",
" <td>41.5600</td>\n",
" <td>0.500806</td>\n",
" <td>$29.1B</td>\n",
" <td>$29,100,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>4962.0000</td>\n",
" <td>1.0</td>\n",
" <td>$4,962,000.00</td>\n",
" <td>0.000085</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>PTR</td>\n",
" <td>Petrochina Co Ltd</td>\n",
" <td>DR</td>\n",
" <td>69.51</td>\n",
" <td>94.43</td>\n",
" <td>0.74</td>\n",
" <td>93.93</td>\n",
" <td>70.9500</td>\n",
" <td>0.146563</td>\n",
" <td>$132.4B</td>\n",
" <td>$132,400,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>236014.3840</td>\n",
" <td>1.0</td>\n",
" <td>$236,014,384.00</td>\n",
" <td>0.000261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>CCI</td>\n",
" <td>Crown Castle International Corp</td>\n",
" <td>CSRT</td>\n",
" <td>88.30</td>\n",
" <td>87.91</td>\n",
" <td>1.00</td>\n",
" <td>88.30</td>\n",
" <td>88.3800</td>\n",
" <td>0.545067</td>\n",
" <td>$30B</td>\n",
" <td>$30,000,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3760.7350</td>\n",
" <td>1.0</td>\n",
" <td>$3,760,735.00</td>\n",
" <td>0.000068</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>NWL</td>\n",
" <td>Newell Brands Inc</td>\n",
" <td>CS</td>\n",
" <td>52.25</td>\n",
" <td>80.54</td>\n",
" <td>0.65</td>\n",
" <td>80.38</td>\n",
" <td>51.9999</td>\n",
" <td>0.174086</td>\n",
" <td>$25.2B</td>\n",
" <td>$25,200,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Household Durables</td>\n",
" <td>8264.3000</td>\n",
" <td>1.0</td>\n",
" <td>$8,264,300.00</td>\n",
" <td>0.000057</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>EXPE</td>\n",
" <td>Expedia Inc</td>\n",
" <td>CS</td>\n",
" <td>120.80</td>\n",
" <td>79.79</td>\n",
" <td>1.51</td>\n",
" <td>80.00</td>\n",
" <td>117.8300</td>\n",
" <td>0.136744</td>\n",
" <td>$17.7B</td>\n",
" <td>$17,700,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>7736.1500</td>\n",
" <td>1.0</td>\n",
" <td>$7,736,150.00</td>\n",
" <td>0.000060</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>PHG</td>\n",
" <td>Koninklijke Philips NV</td>\n",
" <td>DR</td>\n",
" <td>28.84</td>\n",
" <td>70.52</td>\n",
" <td>0.41</td>\n",
" <td>70.34</td>\n",
" <td>29.3500</td>\n",
" <td>0.093628</td>\n",
" <td>$27.6B</td>\n",
" <td>$27,600,000</td>\n",
" <td>Industrials</td>\n",
" <td>Industrial Conglomerates</td>\n",
" <td>26260.2500</td>\n",
" <td>1.0</td>\n",
" <td>$26,260,250.00</td>\n",
" <td>0.000089</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>AMT</td>\n",
" <td>American Tower Corp</td>\n",
" <td>CSRT</td>\n",
" <td>108.51</td>\n",
" <td>67.20</td>\n",
" <td>1.61</td>\n",
" <td>67.40</td>\n",
" <td>108.5800</td>\n",
" <td>0.601310</td>\n",
" <td>$46.1B</td>\n",
" <td>$46,100,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>5249.2250</td>\n",
" <td>1.0</td>\n",
" <td>$5,249,225.00</td>\n",
" <td>0.000068</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>IMBBY</td>\n",
" <td>Imperial Brands PLC</td>\n",
" <td>DR</td>\n",
" <td>47.40</td>\n",
" <td>65.61</td>\n",
" <td>0.72</td>\n",
" <td>65.83</td>\n",
" <td>48.0960</td>\n",
" <td>NaN</td>\n",
" <td>$47.1B</td>\n",
" <td>$47,100,000</td>\n",
" <td>Consumer Staples</td>\n",
" <td>Tobacco</td>\n",
" <td>19673.7480</td>\n",
" <td>1.0</td>\n",
" <td>$19,673,748.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>KHC</td>\n",
" <td>Kraft Heinz Co (The)</td>\n",
" <td>CS</td>\n",
" <td>88.53</td>\n",
" <td>65.76</td>\n",
" <td>1.35</td>\n",
" <td>65.58</td>\n",
" <td>87.4300</td>\n",
" <td>0.303304</td>\n",
" <td>$106.5B</td>\n",
" <td>$106,500,000</td>\n",
" <td>Consumer Staples</td>\n",
" <td>Food Products</td>\n",
" <td>26607.0000</td>\n",
" <td>1.0</td>\n",
" <td>$26,607,000.00</td>\n",
" <td>0.000076</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>ILMN</td>\n",
" <td>Illumina Inc</td>\n",
" <td>CS</td>\n",
" <td>138.00</td>\n",
" <td>47.44</td>\n",
" <td>2.91</td>\n",
" <td>47.42</td>\n",
" <td>184.8500</td>\n",
" <td>0.307062</td>\n",
" <td>$27.1B</td>\n",
" <td>$27,100,000</td>\n",
" <td>Health Care</td>\n",
" <td>Life Sciences Tools &amp; Services</td>\n",
" <td>2313.7060</td>\n",
" <td>1.0</td>\n",
" <td>$2,313,706.00</td>\n",
" <td>0.000026</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>HDB</td>\n",
" <td>H D F C Bank Ltd</td>\n",
" <td>DR</td>\n",
" <td>72.11</td>\n",
" <td>61.91</td>\n",
" <td>1.16</td>\n",
" <td>62.16</td>\n",
" <td>72.3300</td>\n",
" <td>0.460053</td>\n",
" <td>$60.8B</td>\n",
" <td>$60,800,000</td>\n",
" <td>Financials</td>\n",
" <td>Banks</td>\n",
" <td>11493.6810</td>\n",
" <td>1.0</td>\n",
" <td>$11,493,681.00</td>\n",
" <td>0.000087</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>FB</td>\n",
" <td>Facebook Inc</td>\n",
" <td>CS</td>\n",
" <td>127.88</td>\n",
" <td>61.26</td>\n",
" <td>2.09</td>\n",
" <td>61.19</td>\n",
" <td>128.9950</td>\n",
" <td>0.493637</td>\n",
" <td>$369.5B</td>\n",
" <td>$369,500,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Internet Software &amp; Services</td>\n",
" <td>22160.0000</td>\n",
" <td>1.0</td>\n",
" <td>$22,160,000.00</td>\n",
" <td>0.000030</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>REGN</td>\n",
" <td>Regeneron Pharmaceuticals Inc</td>\n",
" <td>CS</td>\n",
" <td>371.68</td>\n",
" <td>58.02</td>\n",
" <td>6.41</td>\n",
" <td>57.98</td>\n",
" <td>390.3200</td>\n",
" <td>0.287382</td>\n",
" <td>$40.9B</td>\n",
" <td>$40,900,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>4648.9770</td>\n",
" <td>1.0</td>\n",
" <td>$4,648,977.00</td>\n",
" <td>0.000033</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>TAP</td>\n",
" <td>Molson Coors Brewing Co</td>\n",
" <td>CS</td>\n",
" <td>111.25</td>\n",
" <td>60.51</td>\n",
" <td>1.84</td>\n",
" <td>60.46</td>\n",
" <td>107.7200</td>\n",
" <td>0.166011</td>\n",
" <td>$23.1B</td>\n",
" <td>$23,100,000</td>\n",
" <td>Consumer Staples</td>\n",
" <td>Beverages</td>\n",
" <td>3505.2000</td>\n",
" <td>1.0</td>\n",
" <td>$3,505,200.00</td>\n",
" <td>0.000025</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>ADBE</td>\n",
" <td>Adobe Systems Inc</td>\n",
" <td>CS</td>\n",
" <td>107.84</td>\n",
" <td>54.93</td>\n",
" <td>1.96</td>\n",
" <td>55.02</td>\n",
" <td>108.6600</td>\n",
" <td>0.296644</td>\n",
" <td>$54B</td>\n",
" <td>$54,000,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Software</td>\n",
" <td>5552.4150</td>\n",
" <td>1.0</td>\n",
" <td>$5,552,415.00</td>\n",
" <td>0.000031</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>MU</td>\n",
" <td>Micron Technology Inc.</td>\n",
" <td>CS</td>\n",
" <td>17.13</td>\n",
" <td>53.53</td>\n",
" <td>0.32</td>\n",
" <td>53.53</td>\n",
" <td>17.6350</td>\n",
" <td>NaN</td>\n",
" <td>$18.4B</td>\n",
" <td>$18,400,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Semiconductors &amp; Semiconductor Equipment</td>\n",
" <td>12399.0000</td>\n",
" <td>1.0</td>\n",
" <td>$12,399,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>BUD</td>\n",
" <td>Anheuser-Busch InBev SA/NV</td>\n",
" <td>DR</td>\n",
" <td>128.65</td>\n",
" <td>54.27</td>\n",
" <td>2.37</td>\n",
" <td>54.28</td>\n",
" <td>127.2500</td>\n",
" <td>NaN</td>\n",
" <td>$204.6B</td>\n",
" <td>$204,600,000</td>\n",
" <td>Consumer Staples</td>\n",
" <td>Beverages</td>\n",
" <td>42305.0000</td>\n",
" <td>1.0</td>\n",
" <td>$42,305,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>VTR</td>\n",
" <td>Ventas Inc.</td>\n",
" <td>CSRT</td>\n",
" <td>66.95</td>\n",
" <td>52.96</td>\n",
" <td>1.26</td>\n",
" <td>53.13</td>\n",
" <td>67.0150</td>\n",
" <td>NaN</td>\n",
" <td>$22.8B</td>\n",
" <td>$22,800,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3369.7910</td>\n",
" <td>1.0</td>\n",
" <td>$3,369,791.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>FIS</td>\n",
" <td>Fidelity National Information Services Inc</td>\n",
" <td>CS</td>\n",
" <td>76.50</td>\n",
" <td>50.65</td>\n",
" <td>1.51</td>\n",
" <td>50.66</td>\n",
" <td>77.7000</td>\n",
" <td>0.289612</td>\n",
" <td>$25.6B</td>\n",
" <td>$25,600,000</td>\n",
" <td>Information Technology</td>\n",
" <td>IT Services</td>\n",
" <td>7939.6000</td>\n",
" <td>1.0</td>\n",
" <td>$7,939,600.00</td>\n",
" <td>0.000090</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>SNE</td>\n",
" <td>Sony Corp</td>\n",
" <td>DR</td>\n",
" <td>32.89</td>\n",
" <td>51.81</td>\n",
" <td>0.63</td>\n",
" <td>52.21</td>\n",
" <td>32.5301</td>\n",
" <td>0.067437</td>\n",
" <td>$41.3B</td>\n",
" <td>$41,300,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Household Durables</td>\n",
" <td>72991.2060</td>\n",
" <td>1.0</td>\n",
" <td>$72,991,206.00</td>\n",
" <td>0.000119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>EW</td>\n",
" <td>Edwards Lifesciences Corp</td>\n",
" <td>CS</td>\n",
" <td>116.00</td>\n",
" <td>47.99</td>\n",
" <td>2.42</td>\n",
" <td>47.93</td>\n",
" <td>120.0200</td>\n",
" <td>0.287474</td>\n",
" <td>$25.5B</td>\n",
" <td>$25,500,000</td>\n",
" <td>Health Care</td>\n",
" <td>Health Care Equipment &amp; Supplies</td>\n",
" <td>2743.2000</td>\n",
" <td>1.0</td>\n",
" <td>$2,743,200.00</td>\n",
" <td>0.000031</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>377</th>\n",
" <td>EC</td>\n",
" <td>Ecopetrol SA</td>\n",
" <td>DR</td>\n",
" <td>9.04</td>\n",
" <td>NaN</td>\n",
" <td>-0.75</td>\n",
" <td>NaN</td>\n",
" <td>9.0100</td>\n",
" <td>0.298349</td>\n",
" <td>$18.7B</td>\n",
" <td>$18,700,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>13865.5850</td>\n",
" <td>1.0</td>\n",
" <td>$13,865,585.00</td>\n",
" <td>0.000221</td>\n",
" </tr>\n",
" <tr>\n",
" <th>378</th>\n",
" <td>BBL</td>\n",
" <td>BHP Billiton PLC</td>\n",
" <td>DR</td>\n",
" <td>29.55</td>\n",
" <td>NaN</td>\n",
" <td>-2.40</td>\n",
" <td>NaN</td>\n",
" <td>30.9550</td>\n",
" <td>NaN</td>\n",
" <td>$81.8B</td>\n",
" <td>$81,800,000</td>\n",
" <td>Materials</td>\n",
" <td>Metals &amp; Mining</td>\n",
" <td>31356.0000</td>\n",
" <td>1.0</td>\n",
" <td>$31,356,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>379</th>\n",
" <td>BHP</td>\n",
" <td>BHP Billiton Ltd</td>\n",
" <td>DR</td>\n",
" <td>33.99</td>\n",
" <td>NaN</td>\n",
" <td>-2.40</td>\n",
" <td>NaN</td>\n",
" <td>35.3500</td>\n",
" <td>NaN</td>\n",
" <td>$93.3B</td>\n",
" <td>$93,300,000</td>\n",
" <td>Materials</td>\n",
" <td>Metals &amp; Mining</td>\n",
" <td>31356.0000</td>\n",
" <td>1.0</td>\n",
" <td>$31,356,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>380</th>\n",
" <td>VOD</td>\n",
" <td>Vodafone Group PLC</td>\n",
" <td>DR</td>\n",
" <td>27.80</td>\n",
" <td>NaN</td>\n",
" <td>-1.85</td>\n",
" <td>NaN</td>\n",
" <td>28.2100</td>\n",
" <td>NaN</td>\n",
" <td>$75.7B</td>\n",
" <td>$75,700,000</td>\n",
" <td>Telecommunication Services</td>\n",
" <td>Wireless Telecommunication Services</td>\n",
" <td>58923.2710</td>\n",
" <td>1.0</td>\n",
" <td>$58,923,271.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>381</th>\n",
" <td>CXO</td>\n",
" <td>Concho Resources Inc</td>\n",
" <td>CS</td>\n",
" <td>136.70</td>\n",
" <td>NaN</td>\n",
" <td>-8.50</td>\n",
" <td>NaN</td>\n",
" <td>139.7600</td>\n",
" <td>-0.516660</td>\n",
" <td>$18.6B</td>\n",
" <td>$18,600,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>1532.4890</td>\n",
" <td>1.0</td>\n",
" <td>$1,532,489.00</td>\n",
" <td>-0.000043</td>\n",
" </tr>\n",
" <tr>\n",
" <th>382</th>\n",
" <td>WMB</td>\n",
" <td>Williams Cos Inc. (The)</td>\n",
" <td>CS</td>\n",
" <td>29.13</td>\n",
" <td>NaN</td>\n",
" <td>-1.63</td>\n",
" <td>NaN</td>\n",
" <td>30.3900</td>\n",
" <td>0.469240</td>\n",
" <td>$22.9B</td>\n",
" <td>$22,900,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>7201.0000</td>\n",
" <td>1.0</td>\n",
" <td>$7,201,000.00</td>\n",
" <td>0.000148</td>\n",
" </tr>\n",
" <tr>\n",
" <th>383</th>\n",
" <td>SU</td>\n",
" <td>Suncor Energy Inc.</td>\n",
" <td>CS</td>\n",
" <td>28.43</td>\n",
" <td>NaN</td>\n",
" <td>-1.48</td>\n",
" <td>NaN</td>\n",
" <td>27.7050</td>\n",
" <td>0.198331</td>\n",
" <td>$46.5B</td>\n",
" <td>$46,500,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>19290.9618</td>\n",
" <td>1.0</td>\n",
" <td>$19,290,961.80</td>\n",
" <td>0.000082</td>\n",
" </tr>\n",
" <tr>\n",
" <th>384</th>\n",
" <td>BP</td>\n",
" <td>BP PLC</td>\n",
" <td>DR</td>\n",
" <td>35.84</td>\n",
" <td>NaN</td>\n",
" <td>-1.71</td>\n",
" <td>NaN</td>\n",
" <td>36.1800</td>\n",
" <td>0.074744</td>\n",
" <td>$112.5B</td>\n",
" <td>$112,500,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>193006.0000</td>\n",
" <td>1.0</td>\n",
" <td>$193,006,000.00</td>\n",
" <td>0.000128</td>\n",
" </tr>\n",
" <tr>\n",
" <th>385</th>\n",
" <td>TSLA</td>\n",
" <td>Tesla Motors Inc</td>\n",
" <td>CS</td>\n",
" <td>196.51</td>\n",
" <td>NaN</td>\n",
" <td>-8.45</td>\n",
" <td>NaN</td>\n",
" <td>196.7400</td>\n",
" <td>-0.073656</td>\n",
" <td>$29.8B</td>\n",
" <td>$29,800,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Automobiles</td>\n",
" <td>4568.2340</td>\n",
" <td>1.0</td>\n",
" <td>$4,568,234.00</td>\n",
" <td>-0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>386</th>\n",
" <td>JD</td>\n",
" <td>JD.com Inc</td>\n",
" <td>DR</td>\n",
" <td>26.50</td>\n",
" <td>NaN</td>\n",
" <td>-1.01</td>\n",
" <td>NaN</td>\n",
" <td>27.0150</td>\n",
" <td>-0.001720</td>\n",
" <td>$39.5B</td>\n",
" <td>$39,500,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>32853.3810</td>\n",
" <td>1.0</td>\n",
" <td>$32,853,381.00</td>\n",
" <td>-0.000001</td>\n",
" </tr>\n",
" <tr>\n",
" <th>387</th>\n",
" <td>BCS</td>\n",
" <td>Barclays PLC</td>\n",
" <td>DR</td>\n",
" <td>8.28</td>\n",
" <td>NaN</td>\n",
" <td>-0.29</td>\n",
" <td>NaN</td>\n",
" <td>8.5650</td>\n",
" <td>NaN</td>\n",
" <td>$37.2B</td>\n",
" <td>$37,200,000</td>\n",
" <td>Financials</td>\n",
" <td>Banks</td>\n",
" <td>42784.0440</td>\n",
" <td>1.0</td>\n",
" <td>$42,784,044.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>388</th>\n",
" <td>TRP</td>\n",
" <td>TransCanada Corp</td>\n",
" <td>CS</td>\n",
" <td>46.04</td>\n",
" <td>NaN</td>\n",
" <td>-1.53</td>\n",
" <td>NaN</td>\n",
" <td>46.3000</td>\n",
" <td>0.523026</td>\n",
" <td>$32.8B</td>\n",
" <td>$32,800,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>8344.2792</td>\n",
" <td>1.0</td>\n",
" <td>$8,344,279.20</td>\n",
" <td>0.000133</td>\n",
" </tr>\n",
" <tr>\n",
" <th>389</th>\n",
" <td>CLR</td>\n",
" <td>Continental Resources Inc</td>\n",
" <td>CS</td>\n",
" <td>51.78</td>\n",
" <td>NaN</td>\n",
" <td>-1.46</td>\n",
" <td>NaN</td>\n",
" <td>53.4400</td>\n",
" <td>0.661164</td>\n",
" <td>$20.3B</td>\n",
" <td>$20,300,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>2162.5330</td>\n",
" <td>1.0</td>\n",
" <td>$2,162,533.00</td>\n",
" <td>0.000070</td>\n",
" </tr>\n",
" <tr>\n",
" <th>390</th>\n",
" <td>TS</td>\n",
" <td>Tenaris SA, Luxembourg</td>\n",
" <td>DR</td>\n",
" <td>28.99</td>\n",
" <td>NaN</td>\n",
" <td>-0.67</td>\n",
" <td>NaN</td>\n",
" <td>29.1250</td>\n",
" <td>0.173264</td>\n",
" <td>$17.2B</td>\n",
" <td>$17,200,000</td>\n",
" <td>Energy</td>\n",
" <td>Energy Equipment &amp; Services</td>\n",
" <td>5357.0470</td>\n",
" <td>1.0</td>\n",
" <td>$5,357,047.00</td>\n",
" <td>0.000054</td>\n",
" </tr>\n",
" <tr>\n",
" <th>391</th>\n",
" <td>WDAY</td>\n",
" <td>Workday Inc</td>\n",
" <td>CS</td>\n",
" <td>87.01</td>\n",
" <td>NaN</td>\n",
" <td>-1.79</td>\n",
" <td>NaN</td>\n",
" <td>91.0197</td>\n",
" <td>-0.150826</td>\n",
" <td>$18.2B</td>\n",
" <td>$18,200,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Software</td>\n",
" <td>1351.8460</td>\n",
" <td>1.0</td>\n",
" <td>$1,351,846.00</td>\n",
" <td>-0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>392</th>\n",
" <td>STO</td>\n",
" <td>Statoil ASA</td>\n",
" <td>DR</td>\n",
" <td>16.70</td>\n",
" <td>NaN</td>\n",
" <td>-0.31</td>\n",
" <td>NaN</td>\n",
" <td>16.8800</td>\n",
" <td>0.273997</td>\n",
" <td>$54.2B</td>\n",
" <td>$54,200,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>42411.5300</td>\n",
" <td>1.0</td>\n",
" <td>$42,411,530.00</td>\n",
" <td>0.000214</td>\n",
" </tr>\n",
" <tr>\n",
" <th>393</th>\n",
" <td>PXD</td>\n",
" <td>Pioneer Natural Resources Co</td>\n",
" <td>CS</td>\n",
" <td>185.96</td>\n",
" <td>NaN</td>\n",
" <td>-3.16</td>\n",
" <td>NaN</td>\n",
" <td>186.4100</td>\n",
" <td>NaN</td>\n",
" <td>$31.6B</td>\n",
" <td>$31,600,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>3330.0000</td>\n",
" <td>1.0</td>\n",
" <td>$3,330,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>394</th>\n",
" <td>ETP</td>\n",
" <td>Energy Transfer Partners LP</td>\n",
" <td>UT</td>\n",
" <td>35.30</td>\n",
" <td>NaN</td>\n",
" <td>-0.57</td>\n",
" <td>NaN</td>\n",
" <td>35.8700</td>\n",
" <td>0.195801</td>\n",
" <td>$18.9B</td>\n",
" <td>$18,900,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>22196.0000</td>\n",
" <td>1.0</td>\n",
" <td>$22,196,000.00</td>\n",
" <td>0.000230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>395</th>\n",
" <td>SLB</td>\n",
" <td>Schlumberger Ltd</td>\n",
" <td>CS</td>\n",
" <td>81.32</td>\n",
" <td>NaN</td>\n",
" <td>-1.19</td>\n",
" <td>NaN</td>\n",
" <td>81.4150</td>\n",
" <td>0.242969</td>\n",
" <td>$113.3B</td>\n",
" <td>$113,300,000</td>\n",
" <td>Energy</td>\n",
" <td>Energy Equipment &amp; Services</td>\n",
" <td>29901.0000</td>\n",
" <td>1.0</td>\n",
" <td>$29,901,000.00</td>\n",
" <td>0.000064</td>\n",
" </tr>\n",
" <tr>\n",
" <th>396</th>\n",
" <td>VRTX</td>\n",
" <td>Vertex Pharmaceuticals Inc</td>\n",
" <td>CS</td>\n",
" <td>79.23</td>\n",
" <td>NaN</td>\n",
" <td>-1.13</td>\n",
" <td>NaN</td>\n",
" <td>85.7700</td>\n",
" <td>-0.043041</td>\n",
" <td>$21B</td>\n",
" <td>$21,000,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>1557.4390</td>\n",
" <td>1.0</td>\n",
" <td>$1,557,439.00</td>\n",
" <td>-0.000003</td>\n",
" </tr>\n",
" <tr>\n",
" <th>397</th>\n",
" <td>BSX</td>\n",
" <td>Boston Scientific Corp</td>\n",
" <td>CS</td>\n",
" <td>22.95</td>\n",
" <td>NaN</td>\n",
" <td>-0.26</td>\n",
" <td>NaN</td>\n",
" <td>23.5150</td>\n",
" <td>0.267345</td>\n",
" <td>$31.9B</td>\n",
" <td>$31,900,000</td>\n",
" <td>Health Care</td>\n",
" <td>Health Care Equipment &amp; Supplies</td>\n",
" <td>7956.0000</td>\n",
" <td>1.0</td>\n",
" <td>$7,956,000.00</td>\n",
" <td>0.000067</td>\n",
" </tr>\n",
" <tr>\n",
" <th>398</th>\n",
" <td>TEF</td>\n",
" <td>Telefonica SA</td>\n",
" <td>DR</td>\n",
" <td>9.66</td>\n",
" <td>NaN</td>\n",
" <td>-0.09</td>\n",
" <td>NaN</td>\n",
" <td>9.6350</td>\n",
" <td>0.284554</td>\n",
" <td>$47.1B</td>\n",
" <td>$47,100,000</td>\n",
" <td>Telecommunication Services</td>\n",
" <td>Diversified Telecommunication Services</td>\n",
" <td>52879.8770</td>\n",
" <td>1.0</td>\n",
" <td>$52,879,877.00</td>\n",
" <td>0.000319</td>\n",
" </tr>\n",
" <tr>\n",
" <th>399</th>\n",
" <td>CNQ</td>\n",
" <td>Canadian Natural Resources Ltd</td>\n",
" <td>CS</td>\n",
" <td>32.13</td>\n",
" <td>NaN</td>\n",
" <td>-0.29</td>\n",
" <td>NaN</td>\n",
" <td>31.8500</td>\n",
" <td>0.344678</td>\n",
" <td>$35.5B</td>\n",
" <td>$35,500,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>8039.5961</td>\n",
" <td>1.0</td>\n",
" <td>$8,039,596.10</td>\n",
" <td>0.000078</td>\n",
" </tr>\n",
" <tr>\n",
" <th>400</th>\n",
" <td>LNKD</td>\n",
" <td>LinkedIn Corp</td>\n",
" <td>CS</td>\n",
" <td>190.74</td>\n",
" <td>NaN</td>\n",
" <td>-1.66</td>\n",
" <td>NaN</td>\n",
" <td>191.2100</td>\n",
" <td>0.121793</td>\n",
" <td>$25.8B</td>\n",
" <td>$25,800,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Internet Software &amp; Services</td>\n",
" <td>3434.8530</td>\n",
" <td>1.0</td>\n",
" <td>$3,434,853.00</td>\n",
" <td>0.000016</td>\n",
" </tr>\n",
" <tr>\n",
" <th>401</th>\n",
" <td>NOK</td>\n",
" <td>Nokia Corp</td>\n",
" <td>DR</td>\n",
" <td>4.95</td>\n",
" <td>NaN</td>\n",
" <td>-0.04</td>\n",
" <td>NaN</td>\n",
" <td>5.4850</td>\n",
" <td>0.128740</td>\n",
" <td>$32B</td>\n",
" <td>$32,000,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Communications Equipment</td>\n",
" <td>19486.1040</td>\n",
" <td>1.0</td>\n",
" <td>$19,486,104.00</td>\n",
" <td>0.000078</td>\n",
" </tr>\n",
" <tr>\n",
" <th>402</th>\n",
" <td>AVGO</td>\n",
" <td>Broadcom Ltd</td>\n",
" <td>CS</td>\n",
" <td>170.09</td>\n",
" <td>NaN</td>\n",
" <td>-1.07</td>\n",
" <td>NaN</td>\n",
" <td>174.4000</td>\n",
" <td>0.382127</td>\n",
" <td>$69.1B</td>\n",
" <td>$69,100,000</td>\n",
" <td>Information Technology</td>\n",
" <td>Semiconductors &amp; Semiconductor Equipment</td>\n",
" <td>10944.0000</td>\n",
" <td>1.0</td>\n",
" <td>$10,944,000.00</td>\n",
" <td>0.000061</td>\n",
" </tr>\n",
" <tr>\n",
" <th>403</th>\n",
" <td>CEO</td>\n",
" <td>Cnooc Ltd</td>\n",
" <td>DR</td>\n",
" <td>133.46</td>\n",
" <td>NaN</td>\n",
" <td>-0.74</td>\n",
" <td>NaN</td>\n",
" <td>132.6100</td>\n",
" <td>NaN</td>\n",
" <td>$60.6B</td>\n",
" <td>$60,600,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>22071.5980</td>\n",
" <td>1.0</td>\n",
" <td>$22,071,598.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>404</th>\n",
" <td>CVX</td>\n",
" <td>Chevron Corp</td>\n",
" <td>CS</td>\n",
" <td>101.08</td>\n",
" <td>NaN</td>\n",
" <td>-0.40</td>\n",
" <td>NaN</td>\n",
" <td>102.3400</td>\n",
" <td>0.124601</td>\n",
" <td>$192.8B</td>\n",
" <td>$192,800,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>104742.0000</td>\n",
" <td>1.0</td>\n",
" <td>$104,742,000.00</td>\n",
" <td>0.000068</td>\n",
" </tr>\n",
" <tr>\n",
" <th>405</th>\n",
" <td>AIG</td>\n",
" <td>American International Group Inc</td>\n",
" <td>CS</td>\n",
" <td>59.86</td>\n",
" <td>NaN</td>\n",
" <td>-0.05</td>\n",
" <td>NaN</td>\n",
" <td>60.1400</td>\n",
" <td>0.122578</td>\n",
" <td>$64.9B</td>\n",
" <td>$64,900,000</td>\n",
" <td>Financials</td>\n",
" <td>Insurance</td>\n",
" <td>53574.0000</td>\n",
" <td>1.0</td>\n",
" <td>$53,574,000.00</td>\n",
" <td>0.000101</td>\n",
" </tr>\n",
" <tr>\n",
" <th>406</th>\n",
" <td>SHLD</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>10.72</td>\n",
" <td>NaN</td>\n",
" <td>-17.79</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>404 rows × 17 columns</p>\n",
"</div>"
],
"text/plain": [
" Symbol Company Name Security Type \\\n",
"3 EQIX Equinix Inc CSRT \n",
"4 NFLX Netflix Inc CS \n",
"5 ALXN Alexion Pharmaceuticals Inc CS \n",
"6 INCY Incyte Corp CS \n",
"7 CRM salesforce.com Inc CS \n",
"8 NEM Newmont Mining Corp CS \n",
"9 AMZN Amazon.com Inc CS \n",
"10 IMO Imperial Oil Ltd CS \n",
"11 ZBH Zimmer Biomet Holdings Inc CS \n",
"12 SE Spectra Energy Corp CS \n",
"13 PTR Petrochina Co Ltd DR \n",
"14 CCI Crown Castle International Corp CSRT \n",
"15 NWL Newell Brands Inc CS \n",
"16 EXPE Expedia Inc CS \n",
"17 PHG Koninklijke Philips NV DR \n",
"18 AMT American Tower Corp CSRT \n",
"19 IMBBY Imperial Brands PLC DR \n",
"20 KHC Kraft Heinz Co (The) CS \n",
"21 ILMN Illumina Inc CS \n",
"22 HDB H D F C Bank Ltd DR \n",
"23 FB Facebook Inc CS \n",
"24 REGN Regeneron Pharmaceuticals Inc CS \n",
"25 TAP Molson Coors Brewing Co CS \n",
"26 ADBE Adobe Systems Inc CS \n",
"27 MU Micron Technology Inc. CS \n",
"28 BUD Anheuser-Busch InBev SA/NV DR \n",
"29 VTR Ventas Inc. CSRT \n",
"30 FIS Fidelity National Information Services Inc CS \n",
"31 SNE Sony Corp DR \n",
"32 EW Edwards Lifesciences Corp CS \n",
".. ... ... ... \n",
"377 EC Ecopetrol SA DR \n",
"378 BBL BHP Billiton PLC DR \n",
"379 BHP BHP Billiton Ltd DR \n",
"380 VOD Vodafone Group PLC DR \n",
"381 CXO Concho Resources Inc CS \n",
"382 WMB Williams Cos Inc. (The) CS \n",
"383 SU Suncor Energy Inc. CS \n",
"384 BP BP PLC DR \n",
"385 TSLA Tesla Motors Inc CS \n",
"386 JD JD.com Inc DR \n",
"387 BCS Barclays PLC DR \n",
"388 TRP TransCanada Corp CS \n",
"389 CLR Continental Resources Inc CS \n",
"390 TS Tenaris SA, Luxembourg DR \n",
"391 WDAY Workday Inc CS \n",
"392 STO Statoil ASA DR \n",
"393 PXD Pioneer Natural Resources Co CS \n",
"394 ETP Energy Transfer Partners LP UT \n",
"395 SLB Schlumberger Ltd CS \n",
"396 VRTX Vertex Pharmaceuticals Inc CS \n",
"397 BSX Boston Scientific Corp CS \n",
"398 TEF Telefonica SA DR \n",
"399 CNQ Canadian Natural Resources Ltd CS \n",
"400 LNKD LinkedIn Corp CS \n",
"401 NOK Nokia Corp DR \n",
"402 AVGO Broadcom Ltd CS \n",
"403 CEO Cnooc Ltd DR \n",
"404 CVX Chevron Corp CS \n",
"405 AIG American International Group Inc CS \n",
"406 SHLD NaN NaN \n",
"\n",
" Share price P_E EPS P_E_calc Security Price EBITD Margin (TTM) \\\n",
"3 360.25 403.10 0.89 404.78 351.2500 0.413642 \n",
"4 101.47 315.17 0.32 317.09 104.8650 0.584791 \n",
"5 118.34 299.70 0.39 303.44 125.1300 0.362509 \n",
"6 87.10 256.82 0.34 256.18 97.9700 0.207029 \n",
"7 74.27 239.30 0.31 239.58 70.9800 0.095010 \n",
"8 34.23 218.48 0.16 213.94 34.0300 0.368733 \n",
"9 822.96 205.21 4.01 205.23 839.6500 0.092310 \n",
"10 32.41 121.46 0.27 120.04 32.1700 0.083035 \n",
"11 127.15 114.33 1.11 114.55 131.1600 0.393838 \n",
"12 42.55 99.84 0.43 98.95 41.5600 0.500806 \n",
"13 69.51 94.43 0.74 93.93 70.9500 0.146563 \n",
"14 88.30 87.91 1.00 88.30 88.3800 0.545067 \n",
"15 52.25 80.54 0.65 80.38 51.9999 0.174086 \n",
"16 120.80 79.79 1.51 80.00 117.8300 0.136744 \n",
"17 28.84 70.52 0.41 70.34 29.3500 0.093628 \n",
"18 108.51 67.20 1.61 67.40 108.5800 0.601310 \n",
"19 47.40 65.61 0.72 65.83 48.0960 NaN \n",
"20 88.53 65.76 1.35 65.58 87.4300 0.303304 \n",
"21 138.00 47.44 2.91 47.42 184.8500 0.307062 \n",
"22 72.11 61.91 1.16 62.16 72.3300 0.460053 \n",
"23 127.88 61.26 2.09 61.19 128.9950 0.493637 \n",
"24 371.68 58.02 6.41 57.98 390.3200 0.287382 \n",
"25 111.25 60.51 1.84 60.46 107.7200 0.166011 \n",
"26 107.84 54.93 1.96 55.02 108.6600 0.296644 \n",
"27 17.13 53.53 0.32 53.53 17.6350 NaN \n",
"28 128.65 54.27 2.37 54.28 127.2500 NaN \n",
"29 66.95 52.96 1.26 53.13 67.0150 NaN \n",
"30 76.50 50.65 1.51 50.66 77.7000 0.289612 \n",
"31 32.89 51.81 0.63 52.21 32.5301 0.067437 \n",
"32 116.00 47.99 2.42 47.93 120.0200 0.287474 \n",
".. ... ... ... ... ... ... \n",
"377 9.04 NaN -0.75 NaN 9.0100 0.298349 \n",
"378 29.55 NaN -2.40 NaN 30.9550 NaN \n",
"379 33.99 NaN -2.40 NaN 35.3500 NaN \n",
"380 27.80 NaN -1.85 NaN 28.2100 NaN \n",
"381 136.70 NaN -8.50 NaN 139.7600 -0.516660 \n",
"382 29.13 NaN -1.63 NaN 30.3900 0.469240 \n",
"383 28.43 NaN -1.48 NaN 27.7050 0.198331 \n",
"384 35.84 NaN -1.71 NaN 36.1800 0.074744 \n",
"385 196.51 NaN -8.45 NaN 196.7400 -0.073656 \n",
"386 26.50 NaN -1.01 NaN 27.0150 -0.001720 \n",
"387 8.28 NaN -0.29 NaN 8.5650 NaN \n",
"388 46.04 NaN -1.53 NaN 46.3000 0.523026 \n",
"389 51.78 NaN -1.46 NaN 53.4400 0.661164 \n",
"390 28.99 NaN -0.67 NaN 29.1250 0.173264 \n",
"391 87.01 NaN -1.79 NaN 91.0197 -0.150826 \n",
"392 16.70 NaN -0.31 NaN 16.8800 0.273997 \n",
"393 185.96 NaN -3.16 NaN 186.4100 NaN \n",
"394 35.30 NaN -0.57 NaN 35.8700 0.195801 \n",
"395 81.32 NaN -1.19 NaN 81.4150 0.242969 \n",
"396 79.23 NaN -1.13 NaN 85.7700 -0.043041 \n",
"397 22.95 NaN -0.26 NaN 23.5150 0.267345 \n",
"398 9.66 NaN -0.09 NaN 9.6350 0.284554 \n",
"399 32.13 NaN -0.29 NaN 31.8500 0.344678 \n",
"400 190.74 NaN -1.66 NaN 191.2100 0.121793 \n",
"401 4.95 NaN -0.04 NaN 5.4850 0.128740 \n",
"402 170.09 NaN -1.07 NaN 174.4000 0.382127 \n",
"403 133.46 NaN -0.74 NaN 132.6100 NaN \n",
"404 101.08 NaN -0.40 NaN 102.3400 0.124601 \n",
"405 59.86 NaN -0.05 NaN 60.1400 0.122578 \n",
"406 10.72 NaN -17.79 NaN NaN NaN \n",
"\n",
" Market Capitalization Market_cap_clean Sector/Industry \\\n",
"3 $25.1B $25,100,000 Real Estate \n",
"4 $45B $45,000,000 Consumer Discretionary \n",
"5 $27.6B $27,600,000 Health Care \n",
"6 $17.8B $17,800,000 Health Care \n",
"7 $48.8B $48,800,000 Information Technology \n",
"8 $18.1B $18,100,000 Materials \n",
"9 $398.9B $398,900,000 Consumer Discretionary \n",
"10 $27.6B $27,600,000 Energy \n",
"11 $26.1B $26,100,000 Health Care \n",
"12 $29.1B $29,100,000 Energy \n",
"13 $132.4B $132,400,000 Energy \n",
"14 $30B $30,000,000 Real Estate \n",
"15 $25.2B $25,200,000 Consumer Discretionary \n",
"16 $17.7B $17,700,000 Consumer Discretionary \n",
"17 $27.6B $27,600,000 Industrials \n",
"18 $46.1B $46,100,000 Real Estate \n",
"19 $47.1B $47,100,000 Consumer Staples \n",
"20 $106.5B $106,500,000 Consumer Staples \n",
"21 $27.1B $27,100,000 Health Care \n",
"22 $60.8B $60,800,000 Financials \n",
"23 $369.5B $369,500,000 Information Technology \n",
"24 $40.9B $40,900,000 Health Care \n",
"25 $23.1B $23,100,000 Consumer Staples \n",
"26 $54B $54,000,000 Information Technology \n",
"27 $18.4B $18,400,000 Information Technology \n",
"28 $204.6B $204,600,000 Consumer Staples \n",
"29 $22.8B $22,800,000 Real Estate \n",
"30 $25.6B $25,600,000 Information Technology \n",
"31 $41.3B $41,300,000 Consumer Discretionary \n",
"32 $25.5B $25,500,000 Health Care \n",
".. ... ... ... \n",
"377 $18.7B $18,700,000 Energy \n",
"378 $81.8B $81,800,000 Materials \n",
"379 $93.3B $93,300,000 Materials \n",
"380 $75.7B $75,700,000 Telecommunication Services \n",
"381 $18.6B $18,600,000 Energy \n",
"382 $22.9B $22,900,000 Energy \n",
"383 $46.5B $46,500,000 Energy \n",
"384 $112.5B $112,500,000 Energy \n",
"385 $29.8B $29,800,000 Consumer Discretionary \n",
"386 $39.5B $39,500,000 Consumer Discretionary \n",
"387 $37.2B $37,200,000 Financials \n",
"388 $32.8B $32,800,000 Energy \n",
"389 $20.3B $20,300,000 Energy \n",
"390 $17.2B $17,200,000 Energy \n",
"391 $18.2B $18,200,000 Information Technology \n",
"392 $54.2B $54,200,000 Energy \n",
"393 $31.6B $31,600,000 Energy \n",
"394 $18.9B $18,900,000 Energy \n",
"395 $113.3B $113,300,000 Energy \n",
"396 $21B $21,000,000 Health Care \n",
"397 $31.9B $31,900,000 Health Care \n",
"398 $47.1B $47,100,000 Telecommunication Services \n",
"399 $35.5B $35,500,000 Energy \n",
"400 $25.8B $25,800,000 Information Technology \n",
"401 $32B $32,000,000 Information Technology \n",
"402 $69.1B $69,100,000 Information Technology \n",
"403 $60.6B $60,600,000 Energy \n",
"404 $192.8B $192,800,000 Energy \n",
"405 $64.9B $64,900,000 Financials \n",
"406 NaN NaN NaN \n",
"\n",
" Industry Revenue (TTM, Thousands) \\\n",
"3 Equity Real Estate Investment Trusts (REITs) 3161.7770 \n",
"4 Internet & Direct Marketing Retail 7624.6280 \n",
"5 Biotechnology 2821.6580 \n",
"6 Biotechnology 941.2430 \n",
"7 Software 7474.5860 \n",
"8 Metals & Mining 7919.0000 \n",
"9 Internet & Direct Marketing Retail 120637.0000 \n",
"10 Oil, Gas & Consumable Fuels 17468.7855 \n",
"11 Health Care Equipment & Supplies 7533.8000 \n",
"12 Oil, Gas & Consumable Fuels 4962.0000 \n",
"13 Oil, Gas & Consumable Fuels 236014.3840 \n",
"14 Equity Real Estate Investment Trusts (REITs) 3760.7350 \n",
"15 Household Durables 8264.3000 \n",
"16 Internet & Direct Marketing Retail 7736.1500 \n",
"17 Industrial Conglomerates 26260.2500 \n",
"18 Equity Real Estate Investment Trusts (REITs) 5249.2250 \n",
"19 Tobacco 19673.7480 \n",
"20 Food Products 26607.0000 \n",
"21 Life Sciences Tools & Services 2313.7060 \n",
"22 Banks 11493.6810 \n",
"23 Internet Software & Services 22160.0000 \n",
"24 Biotechnology 4648.9770 \n",
"25 Beverages 3505.2000 \n",
"26 Software 5552.4150 \n",
"27 Semiconductors & Semiconductor Equipment 12399.0000 \n",
"28 Beverages 42305.0000 \n",
"29 Equity Real Estate Investment Trusts (REITs) 3369.7910 \n",
"30 IT Services 7939.6000 \n",
"31 Household Durables 72991.2060 \n",
"32 Health Care Equipment & Supplies 2743.2000 \n",
".. ... ... \n",
"377 Oil, Gas & Consumable Fuels 13865.5850 \n",
"378 Metals & Mining 31356.0000 \n",
"379 Metals & Mining 31356.0000 \n",
"380 Wireless Telecommunication Services 58923.2710 \n",
"381 Oil, Gas & Consumable Fuels 1532.4890 \n",
"382 Oil, Gas & Consumable Fuels 7201.0000 \n",
"383 Oil, Gas & Consumable Fuels 19290.9618 \n",
"384 Oil, Gas & Consumable Fuels 193006.0000 \n",
"385 Automobiles 4568.2340 \n",
"386 Internet & Direct Marketing Retail 32853.3810 \n",
"387 Banks 42784.0440 \n",
"388 Oil, Gas & Consumable Fuels 8344.2792 \n",
"389 Oil, Gas & Consumable Fuels 2162.5330 \n",
"390 Energy Equipment & Services 5357.0470 \n",
"391 Software 1351.8460 \n",
"392 Oil, Gas & Consumable Fuels 42411.5300 \n",
"393 Oil, Gas & Consumable Fuels 3330.0000 \n",
"394 Oil, Gas & Consumable Fuels 22196.0000 \n",
"395 Energy Equipment & Services 29901.0000 \n",
"396 Biotechnology 1557.4390 \n",
"397 Health Care Equipment & Supplies 7956.0000 \n",
"398 Diversified Telecommunication Services 52879.8770 \n",
"399 Oil, Gas & Consumable Fuels 8039.5961 \n",
"400 Internet Software & Services 3434.8530 \n",
"401 Communications Equipment 19486.1040 \n",
"402 Semiconductors & Semiconductor Equipment 10944.0000 \n",
"403 Oil, Gas & Consumable Fuels 22071.5980 \n",
"404 Oil, Gas & Consumable Fuels 104742.0000 \n",
"405 Insurance 53574.0000 \n",
"406 NaN NaN \n",
"\n",
" count Revenue_clean Profit to mkt cap \n",
"3 1.0 $3,161,777.00 0.000052 \n",
"4 1.0 $7,624,628.00 0.000099 \n",
"5 1.0 $2,821,658.00 0.000037 \n",
"6 1.0 $941,243.00 0.000011 \n",
"7 1.0 $7,474,586.00 0.000015 \n",
"8 1.0 $7,919,000.00 0.000161 \n",
"9 1.0 $120,637,000.00 0.000028 \n",
"10 1.0 $17,468,785.50 0.000053 \n",
"11 1.0 $7,533,800.00 0.000114 \n",
"12 1.0 $4,962,000.00 0.000085 \n",
"13 1.0 $236,014,384.00 0.000261 \n",
"14 1.0 $3,760,735.00 0.000068 \n",
"15 1.0 $8,264,300.00 0.000057 \n",
"16 1.0 $7,736,150.00 0.000060 \n",
"17 1.0 $26,260,250.00 0.000089 \n",
"18 1.0 $5,249,225.00 0.000068 \n",
"19 1.0 $19,673,748.00 0.000000 \n",
"20 1.0 $26,607,000.00 0.000076 \n",
"21 1.0 $2,313,706.00 0.000026 \n",
"22 1.0 $11,493,681.00 0.000087 \n",
"23 1.0 $22,160,000.00 0.000030 \n",
"24 1.0 $4,648,977.00 0.000033 \n",
"25 1.0 $3,505,200.00 0.000025 \n",
"26 1.0 $5,552,415.00 0.000031 \n",
"27 1.0 $12,399,000.00 0.000000 \n",
"28 1.0 $42,305,000.00 0.000000 \n",
"29 1.0 $3,369,791.00 0.000000 \n",
"30 1.0 $7,939,600.00 0.000090 \n",
"31 1.0 $72,991,206.00 0.000119 \n",
"32 1.0 $2,743,200.00 0.000031 \n",
".. ... ... ... \n",
"377 1.0 $13,865,585.00 0.000221 \n",
"378 1.0 $31,356,000.00 0.000000 \n",
"379 1.0 $31,356,000.00 0.000000 \n",
"380 1.0 $58,923,271.00 0.000000 \n",
"381 1.0 $1,532,489.00 -0.000043 \n",
"382 1.0 $7,201,000.00 0.000148 \n",
"383 1.0 $19,290,961.80 0.000082 \n",
"384 1.0 $193,006,000.00 0.000128 \n",
"385 1.0 $4,568,234.00 -0.000011 \n",
"386 1.0 $32,853,381.00 -0.000001 \n",
"387 1.0 $42,784,044.00 0.000000 \n",
"388 1.0 $8,344,279.20 0.000133 \n",
"389 1.0 $2,162,533.00 0.000070 \n",
"390 1.0 $5,357,047.00 0.000054 \n",
"391 1.0 $1,351,846.00 -0.000011 \n",
"392 1.0 $42,411,530.00 0.000214 \n",
"393 1.0 $3,330,000.00 0.000000 \n",
"394 1.0 $22,196,000.00 0.000230 \n",
"395 1.0 $29,901,000.00 0.000064 \n",
"396 1.0 $1,557,439.00 -0.000003 \n",
"397 1.0 $7,956,000.00 0.000067 \n",
"398 1.0 $52,879,877.00 0.000319 \n",
"399 1.0 $8,039,596.10 0.000078 \n",
"400 1.0 $3,434,853.00 0.000016 \n",
"401 1.0 $19,486,104.00 0.000078 \n",
"402 1.0 $10,944,000.00 0.000061 \n",
"403 1.0 $22,071,598.00 0.000000 \n",
"404 1.0 $104,742,000.00 0.000068 \n",
"405 1.0 $53,574,000.00 0.000101 \n",
"406 NaN NaN NaN \n",
"\n",
"[404 rows x 17 columns]"
]
},
"execution_count": 193,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"PE_data.drop([0,1,2])\n"
]
},
{
"cell_type": "code",
"execution_count": 194,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 407 entries, 0 to 406\n",
"Data columns (total 17 columns):\n",
"Symbol 407 non-null object\n",
"Company Name 406 non-null object\n",
"Security Type 406 non-null object\n",
"Share price 407 non-null float64\n",
"P_E 358 non-null float64\n",
"EPS 407 non-null float64\n",
"P_E_calc 358 non-null float64\n",
"Security Price 406 non-null float64\n",
"EBITD Margin (TTM) 336 non-null float64\n",
"Market Capitalization 406 non-null object\n",
"Market_cap_clean 406 non-null object\n",
"Sector/Industry 406 non-null object\n",
"Industry 406 non-null object\n",
"Revenue (TTM, Thousands) 406 non-null float64\n",
"count 406 non-null float64\n",
"Revenue_clean 406 non-null object\n",
"Profit to mkt cap 406 non-null float64\n",
"dtypes: float64(9), object(8)\n",
"memory usage: 54.1+ KB\n"
]
}
],
"source": [
"PE_data.info()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## General cleaning"
]
},
{
"cell_type": "code",
"execution_count": 195,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#convert from non-null object to string\n",
"PE_data['P_E'] = PE_data['P_E'].astype(str)\n"
]
},
{
"cell_type": "code",
"execution_count": 196,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#strip/remove/drop where the row is #N/A \n",
"#(this means the company had negative earnings, creating a negative P/E -- it's therefore excluded from calculation)\n",
"PE_data = PE_data[PE_data.P_E != '#N/A']\n",
"PE_data = PE_data[PE_data.P_E != 'nan']\n",
"#converting the clean P_E values over to float (number) now that the N/A is stripped\n",
"PE_data['P_E'] = PE_data['P_E'].astype(float)"
]
},
{
"cell_type": "code",
"execution_count": 197,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Symbol</th>\n",
" <th>Company Name</th>\n",
" <th>Security Type</th>\n",
" <th>Share price</th>\n",
" <th>P_E</th>\n",
" <th>EPS</th>\n",
" <th>P_E_calc</th>\n",
" <th>Security Price</th>\n",
" <th>EBITD Margin (TTM)</th>\n",
" <th>Market Capitalization</th>\n",
" <th>Market_cap_clean</th>\n",
" <th>Sector/Industry</th>\n",
" <th>Industry</th>\n",
" <th>Revenue (TTM, Thousands)</th>\n",
" <th>count</th>\n",
" <th>Revenue_clean</th>\n",
" <th>Profit to mkt cap</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>GSK</td>\n",
" <td>Glaxosmithkline PLC</td>\n",
" <td>DR</td>\n",
" <td>41.68</td>\n",
" <td>3228.51</td>\n",
" <td>0.01</td>\n",
" <td>4168.00</td>\n",
" <td>42.970</td>\n",
" <td>NaN</td>\n",
" <td>$104.3B</td>\n",
" <td>$104,300,000</td>\n",
" <td>Health Care</td>\n",
" <td>Pharmaceuticals</td>\n",
" <td>34570.144</td>\n",
" <td>1.0</td>\n",
" <td>$34,570,144.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>RIO</td>\n",
" <td>Rio Tinto PLC</td>\n",
" <td>DR</td>\n",
" <td>31.77</td>\n",
" <td>1246.86</td>\n",
" <td>0.03</td>\n",
" <td>1059.00</td>\n",
" <td>33.150</td>\n",
" <td>NaN</td>\n",
" <td>$59.7B</td>\n",
" <td>$59,700,000</td>\n",
" <td>Materials</td>\n",
" <td>Metals &amp; Mining</td>\n",
" <td>32349.000</td>\n",
" <td>1.0</td>\n",
" <td>$32,349,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>KMI</td>\n",
" <td>Kinder Morgan Inc.</td>\n",
" <td>CS</td>\n",
" <td>20.36</td>\n",
" <td>552.66</td>\n",
" <td>0.04</td>\n",
" <td>509.00</td>\n",
" <td>21.670</td>\n",
" <td>0.492764</td>\n",
" <td>$49.2B</td>\n",
" <td>$49,200,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>13682.000</td>\n",
" <td>1.0</td>\n",
" <td>$13,682,000.00</td>\n",
" <td>0.000137</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EQIX</td>\n",
" <td>Equinix Inc</td>\n",
" <td>CSRT</td>\n",
" <td>360.25</td>\n",
" <td>403.10</td>\n",
" <td>0.89</td>\n",
" <td>404.78</td>\n",
" <td>351.250</td>\n",
" <td>0.413642</td>\n",
" <td>$25.1B</td>\n",
" <td>$25,100,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3161.777</td>\n",
" <td>1.0</td>\n",
" <td>$3,161,777.00</td>\n",
" <td>0.000052</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>NFLX</td>\n",
" <td>Netflix Inc</td>\n",
" <td>CS</td>\n",
" <td>101.47</td>\n",
" <td>315.17</td>\n",
" <td>0.32</td>\n",
" <td>317.09</td>\n",
" <td>104.865</td>\n",
" <td>0.584791</td>\n",
" <td>$45B</td>\n",
" <td>$45,000,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>7624.628</td>\n",
" <td>1.0</td>\n",
" <td>$7,624,628.00</td>\n",
" <td>0.000099</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Symbol Company Name Security Type Share price P_E EPS \\\n",
"0 GSK Glaxosmithkline PLC DR 41.68 3228.51 0.01 \n",
"1 RIO Rio Tinto PLC DR 31.77 1246.86 0.03 \n",
"2 KMI Kinder Morgan Inc. CS 20.36 552.66 0.04 \n",
"3 EQIX Equinix Inc CSRT 360.25 403.10 0.89 \n",
"4 NFLX Netflix Inc CS 101.47 315.17 0.32 \n",
"\n",
" P_E_calc Security Price EBITD Margin (TTM) Market Capitalization \\\n",
"0 4168.00 42.970 NaN $104.3B \n",
"1 1059.00 33.150 NaN $59.7B \n",
"2 509.00 21.670 0.492764 $49.2B \n",
"3 404.78 351.250 0.413642 $25.1B \n",
"4 317.09 104.865 0.584791 $45B \n",
"\n",
" Market_cap_clean Sector/Industry \\\n",
"0 $104,300,000 Health Care \n",
"1 $59,700,000 Materials \n",
"2 $49,200,000 Energy \n",
"3 $25,100,000 Real Estate \n",
"4 $45,000,000 Consumer Discretionary \n",
"\n",
" Industry Revenue (TTM, Thousands) \\\n",
"0 Pharmaceuticals 34570.144 \n",
"1 Metals & Mining 32349.000 \n",
"2 Oil, Gas & Consumable Fuels 13682.000 \n",
"3 Equity Real Estate Investment Trusts (REITs) 3161.777 \n",
"4 Internet & Direct Marketing Retail 7624.628 \n",
"\n",
" count Revenue_clean Profit to mkt cap \n",
"0 1.0 $34,570,144.00 0.000000 \n",
"1 1.0 $32,349,000.00 0.000000 \n",
"2 1.0 $13,682,000.00 0.000137 \n",
"3 1.0 $3,161,777.00 0.000052 \n",
"4 1.0 $7,624,628.00 0.000099 "
]
},
"execution_count": 197,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"PE_data.head()"
]
},
{
"cell_type": "code",
"execution_count": 198,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#used to replace spaces w/ \"_\" (strip whitespace)\n",
"PE_data.columns = [x.strip().replace(' ', '_') for x in PE_data.columns]\n",
"PE_data.columns = [x.strip().replace('[', '_') for x in PE_data.columns]\n",
"PE_data.columns = [x.strip().replace(']', '_') for x in PE_data.columns]\n",
"PE_data.columns = [x.strip().replace('/', '_') for x in PE_data.columns]\n",
"PE_data.columns = [x.strip().replace('(', '_') for x in PE_data.columns]\n",
"PE_data.columns = [x.strip().replace(')', '_') for x in PE_data.columns]"
]
},
{
"cell_type": "code",
"execution_count": 199,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Symbol</th>\n",
" <th>Company_Name</th>\n",
" <th>Security_Type</th>\n",
" <th>Share_price</th>\n",
" <th>P_E</th>\n",
" <th>EPS</th>\n",
" <th>P_E_calc</th>\n",
" <th>Security_Price</th>\n",
" <th>EBITD_Margin__TTM_</th>\n",
" <th>Market_Capitalization</th>\n",
" <th>Market_cap_clean</th>\n",
" <th>Sector_Industry</th>\n",
" <th>Industry</th>\n",
" <th>Revenue__TTM,_Thousands_</th>\n",
" <th>count</th>\n",
" <th>Revenue_clean</th>\n",
" <th>Profit_to_mkt_cap</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>GSK</td>\n",
" <td>Glaxosmithkline PLC</td>\n",
" <td>DR</td>\n",
" <td>41.68</td>\n",
" <td>3228.51</td>\n",
" <td>0.01</td>\n",
" <td>4168.00</td>\n",
" <td>42.970</td>\n",
" <td>NaN</td>\n",
" <td>$104.3B</td>\n",
" <td>$104,300,000</td>\n",
" <td>Health Care</td>\n",
" <td>Pharmaceuticals</td>\n",
" <td>34570.144</td>\n",
" <td>1.0</td>\n",
" <td>$34,570,144.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>RIO</td>\n",
" <td>Rio Tinto PLC</td>\n",
" <td>DR</td>\n",
" <td>31.77</td>\n",
" <td>1246.86</td>\n",
" <td>0.03</td>\n",
" <td>1059.00</td>\n",
" <td>33.150</td>\n",
" <td>NaN</td>\n",
" <td>$59.7B</td>\n",
" <td>$59,700,000</td>\n",
" <td>Materials</td>\n",
" <td>Metals &amp; Mining</td>\n",
" <td>32349.000</td>\n",
" <td>1.0</td>\n",
" <td>$32,349,000.00</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>KMI</td>\n",
" <td>Kinder Morgan Inc.</td>\n",
" <td>CS</td>\n",
" <td>20.36</td>\n",
" <td>552.66</td>\n",
" <td>0.04</td>\n",
" <td>509.00</td>\n",
" <td>21.670</td>\n",
" <td>0.492764</td>\n",
" <td>$49.2B</td>\n",
" <td>$49,200,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>13682.000</td>\n",
" <td>1.0</td>\n",
" <td>$13,682,000.00</td>\n",
" <td>0.000137</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EQIX</td>\n",
" <td>Equinix Inc</td>\n",
" <td>CSRT</td>\n",
" <td>360.25</td>\n",
" <td>403.10</td>\n",
" <td>0.89</td>\n",
" <td>404.78</td>\n",
" <td>351.250</td>\n",
" <td>0.413642</td>\n",
" <td>$25.1B</td>\n",
" <td>$25,100,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3161.777</td>\n",
" <td>1.0</td>\n",
" <td>$3,161,777.00</td>\n",
" <td>0.000052</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>NFLX</td>\n",
" <td>Netflix Inc</td>\n",
" <td>CS</td>\n",
" <td>101.47</td>\n",
" <td>315.17</td>\n",
" <td>0.32</td>\n",
" <td>317.09</td>\n",
" <td>104.865</td>\n",
" <td>0.584791</td>\n",
" <td>$45B</td>\n",
" <td>$45,000,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>7624.628</td>\n",
" <td>1.0</td>\n",
" <td>$7,624,628.00</td>\n",
" <td>0.000099</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Symbol Company_Name Security_Type Share_price P_E EPS \\\n",
"0 GSK Glaxosmithkline PLC DR 41.68 3228.51 0.01 \n",
"1 RIO Rio Tinto PLC DR 31.77 1246.86 0.03 \n",
"2 KMI Kinder Morgan Inc. CS 20.36 552.66 0.04 \n",
"3 EQIX Equinix Inc CSRT 360.25 403.10 0.89 \n",
"4 NFLX Netflix Inc CS 101.47 315.17 0.32 \n",
"\n",
" P_E_calc Security_Price EBITD_Margin__TTM_ Market_Capitalization \\\n",
"0 4168.00 42.970 NaN $104.3B \n",
"1 1059.00 33.150 NaN $59.7B \n",
"2 509.00 21.670 0.492764 $49.2B \n",
"3 404.78 351.250 0.413642 $25.1B \n",
"4 317.09 104.865 0.584791 $45B \n",
"\n",
" Market_cap_clean Sector_Industry \\\n",
"0 $104,300,000 Health Care \n",
"1 $59,700,000 Materials \n",
"2 $49,200,000 Energy \n",
"3 $25,100,000 Real Estate \n",
"4 $45,000,000 Consumer Discretionary \n",
"\n",
" Industry Revenue__TTM,_Thousands_ \\\n",
"0 Pharmaceuticals 34570.144 \n",
"1 Metals & Mining 32349.000 \n",
"2 Oil, Gas & Consumable Fuels 13682.000 \n",
"3 Equity Real Estate Investment Trusts (REITs) 3161.777 \n",
"4 Internet & Direct Marketing Retail 7624.628 \n",
"\n",
" count Revenue_clean Profit_to_mkt_cap \n",
"0 1.0 $34,570,144.00 0.000000 \n",
"1 1.0 $32,349,000.00 0.000000 \n",
"2 1.0 $13,682,000.00 0.000137 \n",
"3 1.0 $3,161,777.00 0.000052 \n",
"4 1.0 $7,624,628.00 0.000099 "
]
},
"execution_count": 199,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"PE_data.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setting up PE by sector dataframe"
]
},
{
"cell_type": "code",
"execution_count": 200,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/erikrood/anaconda3/lib/python3.5/site-packages/pandas/core/frame.py:2378: SettingWithCopyWarning:\n",
"\n",
"\n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
"\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>P_E</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Health Care</td>\n",
" <td>3228.51</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Materials</td>\n",
" <td>1246.86</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Energy</td>\n",
" <td>552.66</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Real Estate</td>\n",
" <td>403.10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Consumer Discretionary</td>\n",
" <td>315.17</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry P_E\n",
"0 Health Care 3228.51\n",
"1 Materials 1246.86\n",
"2 Energy 552.66\n",
"3 Real Estate 403.10\n",
"4 Consumer Discretionary 315.17"
]
},
"execution_count": 200,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = PE_data[[11,4]]\n",
"df[['P_E']] = df[['P_E']].astype(float)\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 201,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>P_E</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Materials</td>\n",
" <td>107.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Health Care</td>\n",
" <td>105.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Energy</td>\n",
" <td>78.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Real Estate</td>\n",
" <td>67.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Consumer Discretionary</td>\n",
" <td>36.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry P_E\n",
"0 Materials 107.0\n",
"1 Health Care 105.0\n",
"2 Energy 78.0\n",
"3 Real Estate 67.0\n",
"4 Consumer Discretionary 36.0"
]
},
"execution_count": 201,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#chart_1\n",
"average_PE_sector = df.groupby('Sector_Industry').mean().sort_values(by='P_E',ascending=False).round(decimals=0).reset_index()\n",
"average_PE_sector.head()"
]
},
{
"cell_type": "code",
"execution_count": 202,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>PE_Std_dev</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Health Care</td>\n",
" <td>459.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Materials</td>\n",
" <td>289.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Energy</td>\n",
" <td>136.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Real Estate</td>\n",
" <td>95.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Consumer Discretionary</td>\n",
" <td>54.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry PE_Std_dev\n",
"0 Health Care 459.0\n",
"1 Materials 289.0\n",
"2 Energy 136.0\n",
"3 Real Estate 95.0\n",
"4 Consumer Discretionary 54.0"
]
},
"execution_count": 202,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#chart_2\n",
"std_PE_sector = df.groupby('Sector_Industry').agg(np.std, ddof=0).sort_values(by='P_E',ascending=False).round(decimals=0).reset_index()\n",
"std_PE_sector.columns = ['Sector_Industry', 'PE_Std_dev'] #renaming columns\n",
"std_PE_sector.head()"
]
},
{
"cell_type": "code",
"execution_count": 203,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>P_E</th>\n",
" <th>PE_Std_dev</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Materials</td>\n",
" <td>107.0</td>\n",
" <td>289.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Health Care</td>\n",
" <td>105.0</td>\n",
" <td>459.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Energy</td>\n",
" <td>78.0</td>\n",
" <td>136.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Real Estate</td>\n",
" <td>67.0</td>\n",
" <td>95.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Consumer Discretionary</td>\n",
" <td>36.0</td>\n",
" <td>54.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Information Technology</td>\n",
" <td>30.0</td>\n",
" <td>33.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Consumer Staples</td>\n",
" <td>28.0</td>\n",
" <td>14.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Industrials</td>\n",
" <td>22.0</td>\n",
" <td>11.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Utilities</td>\n",
" <td>20.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Telecommunication Services</td>\n",
" <td>20.0</td>\n",
" <td>8.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry P_E PE_Std_dev\n",
"0 Materials 107.0 289.0\n",
"1 Health Care 105.0 459.0\n",
"2 Energy 78.0 136.0\n",
"3 Real Estate 67.0 95.0\n",
"4 Consumer Discretionary 36.0 54.0\n",
"5 Information Technology 30.0 33.0\n",
"6 Consumer Staples 28.0 14.0\n",
"7 Industrials 22.0 11.0\n",
"8 Utilities 20.0 8.0\n",
"9 Telecommunication Services 20.0 8.0"
]
},
"execution_count": 203,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Chart_2.5\n",
"j1 = average_PE_sector.merge(std_PE_sector, how='left', on=\"Sector_Industry\")\n",
"j1.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 204,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>P_E</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Real Estate</td>\n",
" <td>37.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Energy</td>\n",
" <td>28.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Health Care</td>\n",
" <td>27.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Materials</td>\n",
" <td>25.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Information Technology</td>\n",
" <td>24.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry P_E\n",
"0 Real Estate 37.0\n",
"1 Energy 28.0\n",
"2 Health Care 27.0\n",
"3 Materials 25.0\n",
"4 Information Technology 24.0"
]
},
"execution_count": 204,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#chart_3\n",
"median_PE_sector = df.groupby('Sector_Industry').median().sort_values(by='P_E',ascending=False).round(decimals=0).reset_index()\n",
"median_PE_sector.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## PE by company"
]
},
{
"cell_type": "code",
"execution_count": 205,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Company_Name</th>\n",
" <th>P_E</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Glaxosmithkline PLC</td>\n",
" <td>3229.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Rio Tinto PLC</td>\n",
" <td>1247.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Kinder Morgan Inc.</td>\n",
" <td>553.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Equinix Inc</td>\n",
" <td>403.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Netflix Inc</td>\n",
" <td>315.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Company_Name P_E\n",
"0 Glaxosmithkline PLC 3229.0\n",
"1 Rio Tinto PLC 1247.0\n",
"2 Kinder Morgan Inc. 553.0\n",
"3 Equinix Inc 403.0\n",
"4 Netflix Inc 315.0"
]
},
"execution_count": 205,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#chart_4\n",
"df1 = PE_data[[1,4]]\n",
"#df1.head(100)\n",
"top_PE_company = df1.groupby('Company_Name').mean().sort_values(by='P_E',ascending=False).round(decimals=0).reset_index()\n",
"top_PE_company.head()\n",
"#top_10_PE_company = top_PE_company.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 206,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/erikrood/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:2: SettingWithCopyWarning:\n",
"\n",
"\n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
"\n",
"/Users/erikrood/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:4: SettingWithCopyWarning:\n",
"\n",
"\n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
"\n"
]
}
],
"source": [
"top_10_PE_company = top_PE_company.head(10)\n",
"top_10_PE_company['P_E'] = top_10_PE_company['P_E'].astype(int)\n",
"bottom_10_PE_company = top_PE_company.tail(10)\n",
"bottom_10_PE_company['P_E'] = bottom_10_PE_company['P_E'].astype(int)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EBITD margin by sector"
]
},
{
"cell_type": "code",
"execution_count": 207,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/erikrood/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:5: SettingWithCopyWarning:\n",
"\n",
"\n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
"\n",
"/Users/erikrood/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:6: SettingWithCopyWarning:\n",
"\n",
"\n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
"\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Symbol</th>\n",
" <th>Company_Name</th>\n",
" <th>Security_Type</th>\n",
" <th>Share_price</th>\n",
" <th>P_E</th>\n",
" <th>EPS</th>\n",
" <th>P_E_calc</th>\n",
" <th>Security_Price</th>\n",
" <th>EBITD_Margin__TTM_</th>\n",
" <th>Market_Capitalization</th>\n",
" <th>Market_cap_clean</th>\n",
" <th>Sector_Industry</th>\n",
" <th>Industry</th>\n",
" <th>Revenue__TTM,_Thousands_</th>\n",
" <th>count</th>\n",
" <th>Revenue_clean</th>\n",
" <th>Profit_to_mkt_cap</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>KMI</td>\n",
" <td>Kinder Morgan Inc.</td>\n",
" <td>CS</td>\n",
" <td>20.36</td>\n",
" <td>552.66</td>\n",
" <td>0.04</td>\n",
" <td>509.00</td>\n",
" <td>21.670</td>\n",
" <td>49.27642</td>\n",
" <td>$49.2B</td>\n",
" <td>$49,200,000</td>\n",
" <td>Energy</td>\n",
" <td>Oil, Gas &amp; Consumable Fuels</td>\n",
" <td>13682.000</td>\n",
" <td>1.0</td>\n",
" <td>$13,682,000.00</td>\n",
" <td>0.000137</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EQIX</td>\n",
" <td>Equinix Inc</td>\n",
" <td>CSRT</td>\n",
" <td>360.25</td>\n",
" <td>403.10</td>\n",
" <td>0.89</td>\n",
" <td>404.78</td>\n",
" <td>351.250</td>\n",
" <td>41.36424</td>\n",
" <td>$25.1B</td>\n",
" <td>$25,100,000</td>\n",
" <td>Real Estate</td>\n",
" <td>Equity Real Estate Investment Trusts (REITs)</td>\n",
" <td>3161.777</td>\n",
" <td>1.0</td>\n",
" <td>$3,161,777.00</td>\n",
" <td>0.000052</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>NFLX</td>\n",
" <td>Netflix Inc</td>\n",
" <td>CS</td>\n",
" <td>101.47</td>\n",
" <td>315.17</td>\n",
" <td>0.32</td>\n",
" <td>317.09</td>\n",
" <td>104.865</td>\n",
" <td>58.47908</td>\n",
" <td>$45B</td>\n",
" <td>$45,000,000</td>\n",
" <td>Consumer Discretionary</td>\n",
" <td>Internet &amp; Direct Marketing Retail</td>\n",
" <td>7624.628</td>\n",
" <td>1.0</td>\n",
" <td>$7,624,628.00</td>\n",
" <td>0.000099</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>ALXN</td>\n",
" <td>Alexion Pharmaceuticals Inc</td>\n",
" <td>CS</td>\n",
" <td>118.34</td>\n",
" <td>299.70</td>\n",
" <td>0.39</td>\n",
" <td>303.44</td>\n",
" <td>125.130</td>\n",
" <td>36.25092</td>\n",
" <td>$27.6B</td>\n",
" <td>$27,600,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>2821.658</td>\n",
" <td>1.0</td>\n",
" <td>$2,821,658.00</td>\n",
" <td>0.000037</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>INCY</td>\n",
" <td>Incyte Corp</td>\n",
" <td>CS</td>\n",
" <td>87.10</td>\n",
" <td>256.82</td>\n",
" <td>0.34</td>\n",
" <td>256.18</td>\n",
" <td>97.970</td>\n",
" <td>20.70294</td>\n",
" <td>$17.8B</td>\n",
" <td>$17,800,000</td>\n",
" <td>Health Care</td>\n",
" <td>Biotechnology</td>\n",
" <td>941.243</td>\n",
" <td>1.0</td>\n",
" <td>$941,243.00</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Symbol Company_Name Security_Type Share_price P_E \\\n",
"2 KMI Kinder Morgan Inc. CS 20.36 552.66 \n",
"3 EQIX Equinix Inc CSRT 360.25 403.10 \n",
"4 NFLX Netflix Inc CS 101.47 315.17 \n",
"5 ALXN Alexion Pharmaceuticals Inc CS 118.34 299.70 \n",
"6 INCY Incyte Corp CS 87.10 256.82 \n",
"\n",
" EPS P_E_calc Security_Price EBITD_Margin__TTM_ Market_Capitalization \\\n",
"2 0.04 509.00 21.670 49.27642 $49.2B \n",
"3 0.89 404.78 351.250 41.36424 $25.1B \n",
"4 0.32 317.09 104.865 58.47908 $45B \n",
"5 0.39 303.44 125.130 36.25092 $27.6B \n",
"6 0.34 256.18 97.970 20.70294 $17.8B \n",
"\n",
" Market_cap_clean Sector_Industry \\\n",
"2 $49,200,000 Energy \n",
"3 $25,100,000 Real Estate \n",
"4 $45,000,000 Consumer Discretionary \n",
"5 $27,600,000 Health Care \n",
"6 $17,800,000 Health Care \n",
"\n",
" Industry Revenue__TTM,_Thousands_ \\\n",
"2 Oil, Gas & Consumable Fuels 13682.000 \n",
"3 Equity Real Estate Investment Trusts (REITs) 3161.777 \n",
"4 Internet & Direct Marketing Retail 7624.628 \n",
"5 Biotechnology 2821.658 \n",
"6 Biotechnology 941.243 \n",
"\n",
" count Revenue_clean Profit_to_mkt_cap \n",
"2 1.0 $13,682,000.00 0.000137 \n",
"3 1.0 $3,161,777.00 0.000052 \n",
"4 1.0 $7,624,628.00 0.000099 \n",
"5 1.0 $2,821,658.00 0.000037 \n",
"6 1.0 $941,243.00 0.000011 "
]
},
"execution_count": 207,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#stripping those that don't contain EBITD values\n",
"PE_data['EBITD_Margin__TTM_'] = PE_data['EBITD_Margin__TTM_'].astype(str)\n",
"EBITD_data = PE_data[PE_data.EBITD_Margin__TTM_ != 'nan']\n",
"PE_data['EBITD_Margin__TTM_'] = PE_data['EBITD_Margin__TTM_'].astype(float)\n",
"EBITD_data['EBITD_Margin__TTM_'] = EBITD_data['EBITD_Margin__TTM_'].astype(float)\n",
"EBITD_data['EBITD_Margin__TTM_'] = EBITD_data['EBITD_Margin__TTM_']*100\n",
"EBITD_data.head()"
]
},
{
"cell_type": "code",
"execution_count": 208,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"df2 = EBITD_data[[11,8]]"
]
},
{
"cell_type": "code",
"execution_count": 209,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sector_Industry</th>\n",
" <th>EBITD_Margin__TTM_</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Real Estate</td>\n",
" <td>44.749670</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Financials</td>\n",
" <td>40.461852</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Utilities</td>\n",
" <td>35.396935</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Telecommunication Services</td>\n",
" <td>33.203306</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Information Technology</td>\n",
" <td>29.767919</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sector_Industry EBITD_Margin__TTM_\n",
"0 Real Estate 44.749670\n",
"1 Financials 40.461852\n",
"2 Utilities 35.396935\n",
"3 Telecommunication Services 33.203306\n",
"4 Information Technology 29.767919"
]
},
"execution_count": 209,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#chart_5\n",
"average_EBITD_sector = df2.groupby('Sector_Industry').mean().sort_values(by='EBITD_Margin__TTM_',ascending=False).reset_index()\n",
"average_EBITD_sector.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EBITD margin by company"
]
},
{
"cell_type": "code",
"execution_count": 210,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Company_Name</th>\n",
" <th>EBITD_Margin__TTM_</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Mitsubishi UFJ Financial Group</td>\n",
" <td>87.12821</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Visa Inc</td>\n",
" <td>69.91384</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>CME Group Inc</td>\n",
" <td>68.81269</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Gilead Sciences Inc</td>\n",
" <td>67.69022</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Taiwan Semiconductor Manufacturing Co Ltd</td>\n",
" <td>64.57556</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>American Tower Corp</td>\n",
" <td>60.13103</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Netflix Inc</td>\n",
" <td>58.47908</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Mastercard Inc</td>\n",
" <td>56.59173</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>U.S. Bancorp</td>\n",
" <td>55.64148</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>M&amp;T Bank Corp</td>\n",
" <td>55.29635</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Company_Name EBITD_Margin__TTM_\n",
"0 Mitsubishi UFJ Financial Group 87.12821\n",
"1 Visa Inc 69.91384\n",
"2 CME Group Inc 68.81269\n",
"3 Gilead Sciences Inc 67.69022\n",
"4 Taiwan Semiconductor Manufacturing Co Ltd 64.57556\n",
"5 American Tower Corp 60.13103\n",
"6 Netflix Inc 58.47908\n",
"7 Mastercard Inc 56.59173\n",
"8 U.S. Bancorp 55.64148\n",
"9 M&T Bank Corp 55.29635"
]
},
"execution_count": 210,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#to include revenue:\n",
"##df3 = EBITD_data[[1,8,15]]\n",
"##average_EBITD_company = df3.groupby(['Company_Name','Revenue_clean']).mean().sort_values(by='EBITD_Margin__TTM_',ascending=False).reset_index()\n",
"df3 = EBITD_data[[1,8]]\n",
"average_EBITD_company = df3.groupby(['Company_Name']).mean().sort_values(by='EBITD_Margin__TTM_',ascending=False).reset_index()\n",
"average_EBITD_company.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 211,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#setting up top/bottom 10 for charts\n",
"top_10_EBITD_company = average_EBITD_company.head(10)\n",
"bottom_10_EBITD_company = average_EBITD_company.tail(10)"
]
},
{
"cell_type": "code",
"execution_count": 212,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/74.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 212,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#bar chart\n",
"x = average_PE_sector['Sector_Industry']\n",
"y = average_PE_sector['P_E']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(23, 191, 99)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='average P/E ratio by sector',\n",
" xaxis=dict(\n",
" title='sector',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='avg. P/E ratio'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='average_PE_sector')"
]
},
{
"cell_type": "code",
"execution_count": 213,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/76.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 213,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"#bar chart\n",
"x = median_PE_sector['Sector_Industry']\n",
"y = median_PE_sector['P_E']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(255, 170, 15)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='median P/E ratio by sector',\n",
" xaxis=dict(\n",
" title='sector',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='median P/E ratio'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='median_PE_sector')"
]
},
{
"cell_type": "code",
"execution_count": 214,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/90.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 214,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#combo chart - bar with avg PE, line with std dev\n",
"\n",
"x = j1['Sector_Industry']\n",
"y1 = j1['P_E']\n",
"y2 = j1['PE_Std_dev']\n",
"\n",
"\n",
"trace0 = go.Bar(\n",
" x=x,\n",
" y=y1,\n",
" name='Avg. P/E ratio',\n",
" marker=dict(\n",
" color='rgb(255, 217, 102)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.6\n",
" )\n",
"\n",
"trace1 = go.Scatter(\n",
" x=x,\n",
" y=y2,\n",
" name='Standard deviation of P/E ratio',\n",
" yaxis = 'y2',\n",
" marker=dict(\n",
" color='rgb(84, 226, 129)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
" \n",
"data = [trace0, trace1]\n",
" \n",
"layout = go.Layout(\n",
" title='mean P/E by sector, with standard deviation',\n",
" legend=dict(\n",
" x=.5,\n",
" y=1,\n",
" bgcolor='#E2E2E2',\n",
" bordercolor='#FFFFFF',\n",
" borderwidth=2,\n",
" ),\n",
" xaxis=dict(\n",
" title='category',\n",
" tickangle = 47,\n",
" ),\n",
" \n",
" yaxis=dict(\n",
" title='P/E ratio'\n",
" ),\n",
" \n",
" yaxis2=dict(\n",
" title='Standard deviation',\n",
" overlaying='y',\n",
" side='right'\n",
" ),\n",
" \n",
" margin=go.Margin(\n",
" b = 150,\n",
" r=50,\n",
" t = 50\n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='mean_PE_plus_std')"
]
},
{
"cell_type": "code",
"execution_count": 215,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/80.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 215,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"#bar chart\n",
"x = top_10_PE_company['Company_Name']\n",
"y = top_10_PE_company['P_E']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(91, 184, 255)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='P/E ratio by company (top 10)',\n",
" xaxis=dict(\n",
" title='company',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='P/E ratio'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" ),\n",
" \n",
" annotations=[\n",
" dict(x=xi,y=yi,\n",
" text=str(yi),\n",
" xanchor='center',\n",
" yanchor='bottom',\n",
" showarrow=False,\n",
" ) for xi, yi in zip(x, y)]\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='PE_company_top_10')"
]
},
{
"cell_type": "code",
"execution_count": 216,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/82.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 216,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"#bar chart\n",
"x = bottom_10_PE_company['Company_Name']\n",
"y = bottom_10_PE_company['P_E']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(249, 98, 87)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='P/E ratio by company (bottom 10)',\n",
" xaxis=dict(\n",
" title='company',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='P/E ratio'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
" \n",
" ##annotations=[\n",
" # dict(x=xi,y=yi,\n",
" # text=str(yi),\n",
" # xanchor='center',\n",
" # yanchor='bottom',\n",
" # showarrow=False,\n",
" # ) for xi, yi in zip(x, y)]\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='PE_company_bottom_10')"
]
},
{
"cell_type": "code",
"execution_count": 217,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/84.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 217,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#bar chart\n",
"x = average_EBITD_sector['Sector_Industry']\n",
"y = average_EBITD_sector['EBITD_Margin__TTM_']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(23, 191, 99)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='average EBITD margin by sector',\n",
" xaxis=dict(\n",
" title='sector',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='avg. EBITD margin'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='average_ebitd_sector')"
]
},
{
"cell_type": "code",
"execution_count": 218,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/86.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 218,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#bar chart\n",
"x = top_10_EBITD_company['Company_Name']\n",
"y = top_10_EBITD_company['EBITD_Margin__TTM_']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(91, 184, 255)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='EBITD margin by company (top 10)',\n",
" xaxis=dict(\n",
" title='company',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='EBITD margin'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='EBITD_Margin__TTM__company_top_10')"
]
},
{
"cell_type": "code",
"execution_count": 219,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~erikrood/88.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 219,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#bar chart\n",
"x = bottom_10_EBITD_company['Company_Name']\n",
"y = bottom_10_EBITD_company['EBITD_Margin__TTM_']\n",
"\n",
"data = [\n",
" go.Bar(\n",
" x=x,\n",
" y=y,\n",
" \n",
" marker=dict(\n",
" color='rgb(249, 98, 87)',\n",
" line=dict(\n",
" color='rgb(8,48,107)',\n",
" width=1.5\n",
" ),\n",
" ),\n",
" opacity=0.8\n",
" )\n",
"]\n",
"layout = go.Layout(\n",
" title='EBITD margin by company (bottom 10)',\n",
" xaxis=dict(\n",
" title='company',\n",
" tickangle = 47,\n",
" ),\n",
" yaxis=dict(\n",
" title='EBITD margin'\n",
" ),\n",
" margin=go.Margin(\n",
" b = 220\n",
" \n",
" )\n",
"\n",
" \n",
")\n",
"fig = go.Figure(data=data, layout=layout)\n",
"py.iplot(fig, filename='EBITD_Margin__TTM__company_bottom_10')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment