我正在尝试将表从网站解析到本地数据帧。
以下是html:
[<table class="crDataTable">
<thead>
<tr class="topRow">
<th class="rowTitle">Fiscal year is October-September. All values USD millions.</th>
<th scope="col">2020</th><th scope="col">2016</th><th scope="col">2017</th><th scope="col">2018</th><th scope="col">2019</th>
<th scope="col">5-year trend</th>
</tr>
</thead>
<tbody>
<tr class="partialSum">
<td class="rowTitle">
<a data-ref="ratio_SalesNet1YrGrowth" href="#"><span class="expand"></span></a> Sales/Revenue
</td>
<td class="valueCell">274.52B</td><td class="valueCell">214.23B</td><td class="valueCell">228.57B</td><td class="valueCell">265.81B</td><td class="valueCell">259.97B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[274515000000,214226000000,228572000000,265809000000,259968000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_SalesNet1YrGrowth">
<td class="rowTitle">Sales Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-21.96%</td><td class="valueCell pos-middle">6.70%</td><td class="valueCell pos-top">16.29%</td><td class="valueCell neg">-2.20%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.219620057191774584266797807,0.0669666613763035299170035383,0.1629114677213306966732583169,-0.0219744252451948579619200253]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle"><a data-ref="ratio_CogsGrowth" href="#"><span class="expand"></span></a> Cost of Goods Sold (COGS) incl. D&A</td>
<td class="valueCell">169.56B</td><td class="valueCell">131.51B</td><td class="valueCell">141.7B</td><td class="valueCell">163.83B</td><td class="valueCell">162.26B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[169559000000,131506000000,141702000000,163826000000,162264000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">COGS excluding D&A</td>
<td class="valueCell">-</td><td class="valueCell">121.71B</td><td class="valueCell">132.3B</td><td class="valueCell">154.53B</td><td class="valueCell">150.96B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,121706000000,132302000000,154526000000,150964000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Depreciation & Amortization Expense</td>
<td class="valueCell">-</td><td class="valueCell">9.8B</td><td class="valueCell">9.4B</td><td class="valueCell">9.3B</td><td class="valueCell">11.3B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,9800000000,9400000000,9300000000,11300000000]}'></div></td>
</tr>
<tr class="rowLevel-3">
<td class="rowTitle">Depreciation</td>
<td class="valueCell">-</td><td class="valueCell">8.3B</td><td class="valueCell">8.2B</td><td class="valueCell">9.3B</td><td class="valueCell">11.3B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,8300000000,8200000000,9300000000,11300000000]}'></div></td>
</tr>
<tr class="rowLevel-3">
<td class="rowTitle">Amortization of Intangibles</td>
<td class="valueCell">-</td><td class="valueCell">1.5B</td><td class="valueCell">1.2B</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,1500000000,1200000000,null,null]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_CogsGrowth">
<td class="rowTitle">COGS Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-22.44%</td><td class="valueCell pos-middle">7.75%</td><td class="valueCell pos-top">15.61%</td><td class="valueCell neg">-0.95%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.2244233570615537954340377096,0.0775325840646054172433196964,0.1561304709884123018729446303,-0.0095345061223493218414659456]}'></div></td>
</tr>
<tr class="partialSum">
<td class="rowTitle"><a data-ref="ratio_GrossIncGrowth,ratio_GrossMargin1stHistoricalYear" href="#"><span class="expand"></span></a> Gross Income</td>
<td class="valueCell">104.96B</td><td class="valueCell">82.72B</td><td class="valueCell">86.87B</td><td class="valueCell">101.98B</td><td class="valueCell">97.7B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[104956000000,82720000000,86870000000,101983000000,97704000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_GrossIncGrowth">
<td class="rowTitle">Gross Income Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-21.19%</td><td class="valueCell pos-bottom">5.02%</td><td class="valueCell pos-top">17.40%</td><td class="valueCell neg">-4.20%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.211860208087198445062692938,0.0501692456479690522243713733,0.173972602739726027397260274,-0.0419579733877214829922634165]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_GrossMargin1stHistoricalYear">
<td class="rowTitle">Gross Profit Margin</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">37.58%</td><td class="miniGraphCell">NA</td>
</tr>
</tbody>
</table>, <table class="crDataTable">
<thead>
<tr class="topRow">
<th class="rowTitle"></th>
<th scope="col">2020</th><th scope="col">2016</th><th scope="col">2017</th><th scope="col">2018</th><th scope="col">2019</th>
<th scope="col">5-year trend</th>
</tr>
</thead>
<tbody>
<tr class="mainRow">
<td class="rowTitle"><a data-ref="ratio_SgaGrowth" href="#"><span class="expand"></span></a> SG&A Expense</td>
<td class="valueCell">38.67B</td><td class="valueCell">24.24B</td><td class="valueCell">26.84B</td><td class="valueCell">30.94B</td><td class="valueCell">34.46B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[38668000000,24239000000,26842000000,30941000000,34462000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Research & Development</td>
<td class="valueCell">-</td><td class="valueCell">10.05B</td><td class="valueCell">11.58B</td><td class="valueCell">14.24B</td><td class="valueCell">16.22B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,10045000000,11581000000,14236000000,16217000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Other SG&A</td>
<td class="valueCell">-</td><td class="valueCell">14.19B</td><td class="valueCell">15.26B</td><td class="valueCell">16.71B</td><td class="valueCell">18.25B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,14194000000,15261000000,16705000000,18245000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_SgaGrowth">
<td class="rowTitle">SGA Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-37.32%</td><td class="valueCell pos-top">10.74%</td><td class="valueCell pos-top">15.27%</td><td class="valueCell pos-top">11.38%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.3731509258301437881452363712,0.1073889186847642229464911919,0.1527084419938901721183220326,0.1137972269803820173879318703]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Other Operating Expense</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Unusual Expense</td>
<td class="valueCell">-</td><td class="valueCell"><span class="marketDelta deltaType-negative">(548M)</span></td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-548000000,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">EBIT after Unusual Expense</td>
<td class="valueCell">-</td><td class="valueCell">59.03B</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,59029000000,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Non Operating Income/Expense</td>
<td class="valueCell">-</td><td class="valueCell"><span class="marketDelta deltaType-negative">(200M)</span></td><td class="valueCell">1.18B</td><td class="valueCell"><span class="marketDelta deltaType-negative">(585M)</span></td><td class="valueCell">1.11B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-200000000,1183000000,-585000000,1110000000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Non-Operating Interest Income</td>
<td class="valueCell">-</td><td class="valueCell">4B</td><td class="valueCell">5.2B</td><td class="valueCell">5.69B</td><td class="valueCell">4.96B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,3999000000,5201000000,5686000000,4961000000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Equity in Affiliates (Pretax)</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle"><a data-ref="ratio_InterestExpenseGrowth" href="#"><span class="expand"></span></a> Interest Expense</td>
<td class="valueCell">-</td><td class="valueCell">1.46B</td><td class="valueCell">2.32B</td><td class="valueCell">3.24B</td><td class="valueCell">3.58B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,1456000000,2323000000,3240000000,3576000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_InterestExpenseGrowth">
<td class="rowTitle">Interest Expense Growth</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell pos-top">59.55%</td><td class="valueCell pos-middle">39.47%</td><td class="valueCell pos-bottom">10.37%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,0.595467032967032967032967033,0.39474817046922083512699096,0.1037037037037037037037037037]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Gross Interest Expense</td>
<td class="valueCell">-</td><td class="valueCell">1.46B</td><td class="valueCell">2.32B</td><td class="valueCell">3.24B</td><td class="valueCell">3.58B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,1456000000,2323000000,3240000000,3576000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Interest Capitalized</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="partialSum">
<td class="rowTitle"><a data-ref="ratio_PretaxIncGrowth,ratio_PretaxMargin1stHistoricalYear" href="#"><span class="expand"></span></a> Pretax Income</td>
<td class="valueCell">67.09B</td><td class="valueCell">61.37B</td><td class="valueCell">64.09B</td><td class="valueCell">72.9B</td><td class="valueCell">65.74B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[67091000000,61372000000,64089000000,72903000000,65737000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_PretaxIncGrowth">
<td class="rowTitle">Pretax Income Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-8.52%</td><td class="valueCell pos-bottom">4.43%</td><td class="valueCell pos-top">13.75%</td><td class="valueCell neg">-9.83%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.0852424319208239555230954972,0.044271003063286189141628104,0.1375275008191733370781257314,-0.0982949947190101916244873325]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_PretaxMargin1stHistoricalYear">
<td class="rowTitle">Pretax Margin</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">25.29%</td><td class="miniGraphCell">NA</td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Income Tax</td>
<td class="valueCell">9.68B</td><td class="valueCell">15.69B</td><td class="valueCell">15.74B</td><td class="valueCell">13.37B</td><td class="valueCell">10.48B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[9680000000,15685000000,15738000000,13372000000,10481000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Income Tax - Current Domestic</td>
<td class="valueCell">-</td><td class="valueCell">8.64B</td><td class="valueCell">8.1B</td><td class="valueCell">41.98B</td><td class="valueCell">6.86B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,8642000000,8101000000,41976000000,6859000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Income Tax - Current Foreign</td>
<td class="valueCell">-</td><td class="valueCell">2.11B</td><td class="valueCell">1.67B</td><td class="valueCell">3.99B</td><td class="valueCell">3.96B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,2105000000,1671000000,3986000000,3962000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Income Tax - Deferred Domestic</td>
<td class="valueCell">-</td><td class="valueCell">4.91B</td><td class="valueCell">5.98B</td><td class="valueCell"><span class="marketDelta deltaType-negative">(33.77B)</span></td><td class="valueCell"><span class="marketDelta deltaType-negative">(3.01B)</span></td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,4905000000,5982000000,-33771000000,-3006000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Income Tax - Deferred Foreign</td>
<td class="valueCell">-</td><td class="valueCell">33M</td><td class="valueCell"><span class="marketDelta deltaType-negative">(16M)</span></td><td class="valueCell">1.18B</td><td class="valueCell">2.67B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,33000000,-16000000,1181000000,2666000000]}'></div></td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Income Tax Credits</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Equity in Affiliates</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Other After Tax Income (Expense)</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Consolidated Net Income</td>
<td class="valueCell">57.41B</td><td class="valueCell">45.69B</td><td class="valueCell">48.35B</td><td class="valueCell">59.53B</td><td class="valueCell">55.26B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[57411000000,45687000000,48351000000,59531000000,55256000000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Minority Interest Expense</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="totalRow">
<td class="rowTitle"><a data-ref="ratio_NetIncGrowth,ratio_NetMargin1YrGrowthRate" href="#"><span class="expand"></span></a> Net Income</td>
<td class="valueCell">57.41B</td><td class="valueCell">45.69B</td><td class="valueCell">48.35B</td><td class="valueCell">59.53B</td><td class="valueCell">55.26B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[57411000000,45687000000,48351000000,59531000000,55256000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_NetIncGrowth">
<td class="rowTitle">Net Income Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-20.42%</td><td class="valueCell pos-bottom">5.83%</td><td class="valueCell pos-top">23.12%</td><td class="valueCell neg">-7.18%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.2042117364268171604744735329,0.0583098036640619869984897236,0.2312258278008727844305185001,-0.0718113251919168164485730124]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_NetMargin1YrGrowthRate">
<td class="rowTitle">Net Margin Growth</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">21.25%</td><td class="miniGraphCell">NA</td>
</tr>
<tr class="rowLevel-2">
<td class="rowTitle">Extraordinaries & Discontinued Operations</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="rowLevel-3">
<td class="rowTitle">Extra Items & Gain/Loss Sale Of Assets</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="rowLevel-4">
<td class="rowTitle">Cumulative Effect - Accounting Chg</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="rowLevel-3">
<td class="rowTitle">Discontinued Operations</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Net Income After Extraordinaries</td>
<td class="valueCell">57.41B</td><td class="valueCell">45.69B</td><td class="valueCell">48.35B</td><td class="valueCell">59.53B</td><td class="valueCell">55.26B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[57411000000,45687000000,48351000000,59531000000,55256000000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Preferred Dividends</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,null,null,null,null]}'></div></td>
</tr>
<tr class="partialSum">
<td class="rowTitle">Net Income Available to Common</td>
<td class="valueCell">57.41B</td><td class="valueCell">45.69B</td><td class="valueCell">48.35B</td><td class="valueCell">59.53B</td><td class="valueCell">55.26B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[57411000000,45687000000,48351000000,59531000000,55256000000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle"><a data-ref="ratio_Eps1YrAnnualGrowth" href="#"><span class="expand"></span></a> EPS (Basic)</td>
<td class="valueCell">3.31</td><td class="valueCell">2.09</td><td class="valueCell">2.32</td><td class="valueCell">3.00</td><td class="valueCell">2.99</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[3.3086,2.0875,2.3175,3.0025,2.9914]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_Eps1YrAnnualGrowth">
<td class="rowTitle">EPS (Basic) Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-36.91%</td><td class="valueCell pos-middle">11.02%</td><td class="valueCell pos-top">29.56%</td><td class="valueCell neg">-0.37%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.3690684881823127606842773378,0.110179640718562874251497006,0.2955771305285868392664509169,-0.0036969192339716902581182348]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Basic Shares Outstanding</td>
<td class="valueCell">17.35B</td><td class="valueCell">21.88B</td><td class="valueCell">20.87B</td><td class="valueCell">19.82B</td><td class="valueCell">18.47B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[17352119000,21883280000,20868968000,19821508000,18471336000]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle"><a data-ref="ratio_EpsDilutedGrowth" href="#"><span class="expand"></span></a> EPS (Diluted)</td>
<td class="valueCell">3.28</td><td class="valueCell">2.08</td><td class="valueCell">2.30</td><td class="valueCell">2.98</td><td class="valueCell">2.97</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[3.28,2.0775,2.3025,2.9775,2.9714]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_EpsDilutedGrowth">
<td class="rowTitle">EPS (Diluted) Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-36.66%</td><td class="valueCell pos-middle">10.83%</td><td class="valueCell pos-top">29.32%</td><td class="valueCell neg">-0.20%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.3666158536585365853658536585,0.1083032490974729241877256318,0.2931596091205211726384364821,-0.0020486985726280436607892527]}'></div></td>
</tr>
<tr class="mainRow">
<td class="rowTitle">Diluted Shares Outstanding</td>
<td class="valueCell">17.53B</td><td class="valueCell">22B</td><td class="valueCell">21.01B</td><td class="valueCell">20B</td><td class="valueCell">18.6B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[17528214000,22001124000,21006768000,20000436000,18595652000]}'></div></td>
</tr>
<tr class="partialSum">
<td class="rowTitle"><a data-ref="ratio_EbitdaGrowth,ratio_EbitMargin1stHistoricalYear" href="#"><span class="expand"></span></a> EBITDA</td>
<td class="valueCell">77.34B</td><td class="valueCell">68.28B</td><td class="valueCell">69.43B</td><td class="valueCell">80.34B</td><td class="valueCell">74.54B</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[77344000000,68281000000,69428000000,80342000000,74542000000]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_EbitdaGrowth">
<td class="rowTitle">EBITDA Growth</td>
<td class="valueCell">-</td><td class="valueCell neg">-11.72%</td><td class="valueCell pos-bottom">1.68%</td><td class="valueCell pos-top">15.72%</td><td class="valueCell neg">-7.22%</td><td class="miniGraphCell"><div class="miniGraph" data-chart='{"chartValues":[null,-0.1171778030616466694249069094,0.0167982308402044492611414596,0.1571988246816846229187071499,-0.0721913818426227875830823231]}'></div></td>
</tr>
<tr class="childRow hidden" id="ratio_EbitMargin1stHistoricalYear">
<td class="rowTitle">EBITDA Margin</td>
<td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">-</td><td class="valueCell">28.67%</td><td class="miniGraphCell">NA</td>
</tr>
</tbody>
</table>]
这是我的密码:
import requests
from bs4 import BeautifulSoup
import pandas as pd
URL = "WEBSITE"
r = requests.get(URL)
soup = BeautifulSoup(r.content, 'html5lib')
tables = soup.find_all('table', attrs={'class': 'crDataTable'})
print(tables)
table_rows = tables.find_all('tr')
res = []
for tr in table_rows:
td = tr.find_all('td')
row = [tr.text.strip() for tr in td if tr.text.strip()]
if row:
res.append(row)
df = pd.DataFrame(res, columns=["","2020","2016","2017","2018","2019",""])
print(df)
但是我遇到了这个错误,无法继续:AttributeError:ResultSet对象没有“find_all”属性。您可能将元素列表视为单个元素。当您打算调用find()时,是否调用了find_all()?
有人能帮帮我吗?
我会非常感激的。
提前感谢。
实际上,table
是一个列表,因此您需要遍历它以获取每个元素:
for table in tables:
# here table is the variable in each iteration
错误在这里:table_rows=tables.find_all('tr')
。表
的类型是ResultSet
,所以把它放在循环中。例如:
import requests
import pandas as pd
from bs4 import BeautifulSoup
URL = "WEBSITE"
r = requests.get(URL)
soup = BeautifulSoup(r.content, 'html5lib')
tables = soup.find_all('table', attrs={'class': 'crDataTable'})
res = []
for table in tables: # <-- add for here
table_rows = table.find_all('tr') # <-- table.
for tr in table_rows:
td = tr.find_all('td')
row = [cell.text.strip() for cell in td if cell.text.strip()]
if row:
res.append(row)
df = pd.DataFrame(res, columns=["","2020","2016","2017","2018","2019",""])
print(df)
我想把表抓成CSV文件。怎么往前走? 这是表:
这是我的密码: 这条线给了我错误 "属性错误:'浮点'对象没有属性'exp'"。X,t是Numpy ndarray。
问题内容: 我正在开发Django应用程序,并且出现以下错误 我的模型是这样构造的 我应该做什么? 问题答案: 首先,您必须非常小心地重写以具有非可选参数。记住,每次从一个查询集中获取一个对象时,它将被调用! 这是您想要的正确代码: 如果您只使用该对象的子类,我强烈建议在Animal上设置abstract选项。这样可以确保不为动物创建表,而仅为绵羊(等)创建表。如果未设置abstract,则将创建
我创建了这个简单的GUI: 我让用户界面启动并运行。当我点击按钮时,我在控制台上得到以下错误: 为什么设置为?
问题内容: 我将Selenium webdriver(chrome)与Python结合使用,试图从网页上的所有链接中获取 href 。当我尝试以下操作时: 它设法获取所有链接,但是在get_attribute上出现错误: “ WebElement”对象没有属性“ Get_Attribute” 尽管到处都看起来很正常。 问题答案: “ Get_Attribute”属性不存在,但是“ get_attr
问题内容: 我创建了这个简单的GUI: 我启动并运行了UI。当我单击Grab按钮时,在控制台上出现以下错误: 为什么entryBox设置为None? 问题答案: 并且place在功能Entry对象和所有其他部件的回报None。在python中,执行此操作时.,表达式的结果为返回的值,因此。 你应该将其分成两行,如下所示: 这样,你就可以将参考存储在其中,并且可以按照你的期望进行布局。如果你以块的形