0

Me gustaria transformar el siguiente array en una dataframe:

introducir la descripción de la imagen aquí

import requests 
from bs4 import BeautifulSoup 

ticker = 'OR.SA'
URL = "https://finance.yahoo.com/quote/OR.PA/financials?p={ticker}"
r = requests.get(URL) 

soup = BeautifulSoup(r.content, 'html5lib') 
mydivs = soup.findAll("div", {"class": "Pos(r)"})

Y es en mydivs[2]. Pero es demasiado grande

< div class = "Bgc($bg-content) Pos(r) Z(1) uh-mobile-nav-open_D(n) lw-nav-open_D(n) lw-nav-open_Pos(a) lw-nav-open_T(54px) Bgc($layoutBgColor)!"
data - reactid = "10" > <!-- react-empty: 11 --><!-- react-empty: 12 -->
<div class="YDC-Col1" data-reactid="13" id="YDC-Col1">
   <div class="YDC-Col1-Stack SideSlot-open_D(n)" data-reactid="14" id="YDC-Col1-Stack">
      <div data-reactid="15" id="YDC-Col1-Stack-Composite">
         <div data-reactid="16">
            <div data-locator="subtree-root" id="mrt-node-Col1-0-Empty">
               <div data-react-checksum="-1864753787" data-reactid="1" data-reactroot="" id="Col1-0-Empty-Proxy">
                  <!-- react-empty: 2 -->
               </div>
            </div>
            <script>if (window.performance) {window.performance.mark && window.performance.mark('Col1-0-Empty');window.performance.measure && window.performance.measure('Col1-0-EmptyDone','PageStart','Col1-0-Empty');}</script>
         </div>
         <div data-reactid="17">
            <div data-locator="subtree-root" id="mrt-node-Col1-1-QuoteNav">
               <div data-react-checksum="1718031101" data-reactid="1" data-reactroot="" id="Col1-1-QuoteNav-Proxy">
                  <section data-reactid="2">
                     <div class="Pos(a) H(54px) W(12px) Bgc(white) End(-2px) Z(1) Bxsh($horzScrollItemShadow)" data-reactid="3"></div>
                     <div class="Pos(r) Mstart(a) Mend(a) Bxsh($horzScrollMenuShadow) Ovx(a)" data-reactid="4" data-yaft-module="tdv2-applet-QuoteNav" id="quote-nav">
                        <ul class="List(n) Whs(nw) fin-tab-items W(100%) Lh(1.7) H(50px) Bdbs(s) BdB(4px) Cf Mb(15px) Bdbc($seperatorColor)" data-reactid="5">
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="6" data-test="SUMMARY">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="7" href="/quote/OR.PA?p=OR.PA">
                                 <!-- react-text: 8 --><!-- /react-text --><span data-reactid="9">Summary</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="10" data-test="STATISTICS">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="11" href="/quote/OR.PA/key-statistics?p=OR.PA">
                                 <!-- react-text: 12 --><!-- /react-text --><span data-reactid="13">Statistics</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="14" data-test="HISTORICAL_DATA">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="15" href="/quote/OR.PA/history?p=OR.PA">
                                 <!-- react-text: 16 --><!-- /react-text --><span data-reactid="17">Historical Data</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="18" data-test="COMPANY_PROFILE">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="19" href="/quote/OR.PA/profile?p=OR.PA">
                                 <!-- react-text: 20 --><!-- /react-text --><span data-reactid="21">Profile</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h selected" data-reactid="22" data-test="FINANCIALS">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="23" href="/quote/OR.PA/financials?p=OR.PA">
                                 <!-- react-text: 24 --><!-- /react-text --><span data-reactid="25">Financials</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="26" data-test="ANALYSIS">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="27" href="/quote/OR.PA/analysis?p=OR.PA">
                                 <!-- react-text: 28 --><!-- /react-text --><span data-reactid="29">Analysis</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="30" data-test="OPTIONS">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="31" href="/quote/OR.PA/options?p=OR.PA">
                                 <!-- react-text: 32 --><!-- /react-text --><span data-reactid="33">Options</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="34" data-test="HOLDERS">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="35" href="/quote/OR.PA/holders?p=OR.PA">
                                 <!-- react-text: 36 --><!-- /react-text --><span data-reactid="37">Holders</span>
                              </a>
                           </li>
                           <li class="IbBox Fw(500) fin-tab-item H(50px) desktop_Bgc($hoverBgColor):h desktop-lite_Bgc($hoverBgColor):h" data-reactid="38" data-test="SUSTAINABILITY">
                              <a class="Lh(50px) Ta(c) Bdbw(3px) Bdbs(s) Px(12px) C($linkColor) Bdbc($seperatorColor) D(b) Td(n) selected_Bdbc($linkColor) selected_C(black) selected_Bgc($navSelectedBlue)" data-reactid="39" href="/quote/OR.PA/sustainability?p=OR.PA">
                                 <!-- react-text: 40 --><!-- /react-text --><span data-reactid="41">Sustainability</span>
                              </a>
                           </li>
                        </ul>
                     </div>
                  </section>
               </div>
            </div>
            <script>if (window.performance) {window.performance.mark && window.performance.mark('Col1-1-QuoteNav');window.performance.measure && window.performance.measure('Col1-1-QuoteNavDone','PageStart','Col1-1-QuoteNav');}</script>
         </div>
         <div data-reactid="18">
            <div data-locator="subtree-root" id="mrt-node-Col1-2-QuoteHeader">
               <div data-react-checksum="-1679264645" data-reactid="1" data-reactroot="" id="Col1-2-QuoteHeader-Proxy">
                  <div class="quote-header-section Cf Pos(r) Mb(5px) Maw($maxModuleWidth) Miw($minGridWidth) smartphone_Miw(ini) Miw(ini)!--tab768 Miw(ini)!--tab1024 Mstart(a) Mend(a) Px(20px) smartphone_Pb(0px) smartphone_Mb(0px)" data-reactid="2" data-test="quote-header" data-yaft-module="tdv2-applet-QuoteHeader" id="quote-header-info">
                     <div class="W(100%) Bdts(s) Bdtw(7px) Bdtc($negativeColor)" data-reactid="3"></div>
                     <div class="Mt(15px)" data-reactid="4">
                        <div class="D(ib) Mt(-5px) Mend(20px) Maw(56%)--tab768 Maw(52%) Ov(h) smartphone_Maw(85%) smartphone_Mend(0px)" data-reactid="5">
                           <div class="D(ib) Mb(2px)" data-reactid="6">
                              <h1 class="D(ib) Fz(16px) Lh(18px)" data-reactid="7">OR.PA - L'Oreal S.A.</h1>
                           </div>
                           <div class="C($tertiaryColor) Fz(12px)" data-reactid="8"><span data-reactid="9">Paris - Paris Delayed Price. Currency in EUR</span></div>
                        </div>
                        <div class="D(ib) Va(t) Mt(-8px) Mend(15px) smartphone_Mend(0px) smartphone_Fl(end) smartphone_Mt(0px)" data-reactid="10"></div>
                        <div class="D(ib) Fl(end) W(300px) Cl(end)--mobxl W(250px)--tab768" data-reactid="11"></div>
                     </div>
                  </div>
               </div>
            </div>
            <script>if (window.performance) {window.performance.mark && window.performance.mark('Col1-2-QuoteHeader');window.performance.measure && window.performance.measure('Col1-2-QuoteHeaderDone','PageStart','Col1-2-QuoteHeader');}</script>
         </div>
         <div data-reactid="19">
            <div data-locator="subtree-root" id="mrt-node-Col1-3-Financials">
               <div data-react-checksum="-21127704" data-reactid="1" data-reactroot="" id="Col1-3-Financials-Proxy">
                  <section class="smartphone_Px(20px) Mb(30px)" data-reactid="2" data-test="qsp-financial" data-yaft-module="tdv2-applet-Financials">
                     <div class="Mt(18px) Mb(15px)" data-reactid="3">
                        <div class="IbBox" data-reactid="4">
                           <span class="Mend(10px) smartphone_D(n)" data-reactid="5">
                              <span data-reactid="6">Show</span><!-- react-text: 7 -->:<!-- /react-text -->
                           </span>
                           <div class="D(ib)" data-reactid="8">
                              <div class="Mend(10px) D(ib) C($primaryColor) Fw(b) Pend(10px) H(18px) selected BdEnd Bdc($seperatorColor)" data-reactid="9"><span data-reactid="10">Income Statement</span></div>
                              <a class="Mend(10px) P(0px) M(0px) C($linkColor) C($primaryColor):h Bd(0px) O(n)" data-reactid="11" href="/quote/OR.PA/balance-sheet?p=OR.PA">
                                 <div class="Fw(500) D(ib) Pend(10px) H(18px) BdEnd Bdc($seperatorColor)" data-reactid="12"><span data-reactid="13">Balance Sheet</span></div>
                              </a>
                              <a class="Mend(10px) P(0px) M(0px) C($linkColor) C($primaryColor):h Bd(0px) O(n)" data-reactid="14" href="/quote/OR.PA/cash-flow?p=OR.PA">
                                 <div class="Fw(500) D(ib) Pend(10px) H(18px)" data-reactid="15"><span data-reactid="16">Cash Flow</span></div>
                              </a>
                           </div>
                        </div>
                        <div class="Fl(end) smartphone_Fl(n) IbBox smartphone_My(10px) smartphone_D(b)" data-reactid="17">
                           <div class="Fz(s) Fw(500) D(ib) H(18px) C($primaryColor):h BdEnd Bdc($seperatorColor) C($primaryColor) Pend(15px) Mend(15px)" data-reactid="18"><span data-reactid="19">Annual</span></div>
                        </div>
                     </div>
                     <div class="Mb(10px)" data-reactid="20">
                        <h3 class="D(ib) Fz(20px) Fw(b)" data-reactid="21"><span data-reactid="22">Income Statement</span></h3>
                        <span class="Fz(xs) C($tertiaryColor) Mstart(25px) smartphone_Mstart(0px) smartphone_D(b) smartphone_Mt(5px)" data-reactid="23"><span data-reactid="24">All numbers in thousands</span></span>
                     </div>
                     <div class="Pos(r)" data-reactid="25">
                        <div class="W(100%) Whs(nw) Ovx(a) BdT Bdtc($seperatorColor)" data-reactid="26">
                           <div class="M(0) Whs(n) BdEnd Bdc($seperatorColor) D(itb)" data-reactid="27">
                              <div class="D(tbhg)" data-reactid="28">
                                 <div class="D(tbr) C($primaryColor)" data-reactid="29">
                                    <div class="D(ib) Fw(b) Ta(start) Px(15px)--mv2 Px(10px) W(247px)--mv2 W(222px) Bxz(bb) Bdendw(1px) Bdstartw(1px) Bdbw(1px) Bdends(s) Bdstarts(s) Bdbs(s) Bdc($seperatorColor) Py(6px) Pos(st) Start(0) Bgc($lv2BgColor)" data-reactid="30">
                                       <span data-reactid="31">Breakdown</span>
                                       <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="32"></div>
                                    </div>
                                    <div class="D(ib) Fw(b) Ta(c) Pstart(6px) Pend(4px) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Tt(u) Bgc($lv1BgColor)" data-reactid="33"><span data-reactid="34">ttm</span></div>
                                    <div class="D(ib) Fw(b) Ta(c) Pstart(6px) Pend(4px) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="35"><span data-reactid="36">12/31/2019</span></div>
                                    <div class="D(ib) Fw(b) Ta(c) Pstart(6px) Pend(4px) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor)" data-reactid="37"><span data-reactid="38">12/31/2018</span></div>
                                    <div class="D(ib) Fw(b) Ta(c) Pstart(6px) Pend(4px) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="39"><span data-reactid="40">12/31/2017</span></div>
                                    <div class="D(ib) Fw(b) Ta(c) Pstart(6px) Pend(4px) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Pend(10px) Bgc($lv1BgColor)" data-reactid="41"><span data-reactid="42">12/31/2016</span></div>
                                 </div>
                              </div>
                              <div class="D(tbrg)" data-reactid="43">
                                 <div class="rw-expnded" data-reactid="44" data-test="fin-row">
                                    <div class="D(tbr) fi-row Bgc($hoverBgColor):h" data-reactid="45">
                                       <div class="D(tbc) Ta(start) Pend(15px)--mv2 Pend(10px) Bxz(bb) Py(8px) Bdends(s) Bdbs(s) Bdstarts(s) Bdstartw(1px) Bdbw(1px) Bdendw(1px) Bdc($seperatorColor) Pos(st) Start(0) Bgc($lv2BgColor) fi-row:h_Bgc($hoverBgColor) Pstart(15px)--mv2 Pstart(10px)" data-reactid="46">
                                          <div class="D(ib) Va(m) Ell Mt(-3px) W(215px)--mv2 W(200px)" data-reactid="47" title="Total Revenue"><span class="Va(m)" data-reactid="48">Total Revenue</span></div>
                                          <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="49"></div>
                                       </div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="50" data-test="fin-col"><span data-reactid="51">29,873,600</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="52" data-test="fin-col"><span data-reactid="53">29,873,600</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="54" data-test="fin-col"><span data-reactid="55">26,937,400</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="56" data-test="fin-col"><span data-reactid="57">26,023,700</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Pend(10px) Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="58" data-test="fin-col"><span data-reactid="59">25,837,100</span></div>
                                    </div>
                                    <div class="D(b)" data-reactid="60"></div>
                                 </div>
                                 <div class="rw-expnded" data-reactid="61" data-test="fin-row">
                                    <div class="D(tbr) fi-row Bgc($hoverBgColor):h" data-reactid="62">
                                       <div class="D(tbc) Ta(start) Pend(15px)--mv2 Pend(10px) Bxz(bb) Py(8px) Bdends(s) Bdbs(s) Bdstarts(s) Bdstartw(1px) Bdbw(1px) Bdendw(1px) Bdc($seperatorColor) Pos(st) Start(0) Bgc($lv2BgColor) fi-row:h_Bgc($hoverBgColor) Pstart(15px)--mv2 Pstart(10px)" data-reactid="63">
                                          <div class="D(ib) Va(m) Ell Mt(-3px) W(215px)--mv2 W(200px)" data-reactid="64" title="Cost of Revenue"><span class="Va(m)" data-reactid="65">Cost of Revenue</span></div>
                                          <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="66"></div>
                                       </div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="67" data-test="fin-col"><span data-reactid="68">8,064,700</span></div>
                                       <div class="D(tbc) Ta(c) Pstar ... >7,331,600</span></div>
                                       <div class="D(tbc) Ta(c)  ... reactid="76">7,341,700</span></div>
                                    </div>
                                    <div class="D(b)" data-reactid="77"></div>
                                 </div>
                                 <div class="rw-expnded" data-reactid="78" data-test="fin-row">
                                    <div class="D(tbr) fi-row Bgc($hoverBgColor):h" data-reactid="79">
                                       <div class="D(tbc) Ta(start) Pend(15px)--mv2 Pend(10px) Bxz(bb) Py(8px) Bdends(s) Bdbs(s) Bdstarts(s) Bdstartw(1px) Bdbw(1px) Bdendw(1px) Bdc($seperatorColor) Pos(st) Start(0) Bgc($lv2BgColor) fi-row:h_Bgc($hoverBgColor) Pstart(15px)--mv2 Pstart(10px)" data-reactid="80">
                                          <div class="D(ib) Va(m) Ell Mt(-3px) W(215px)--mv2 W(200px)" data-reactid="81" title="Gross Profit"><span class="Va(m)" data-reactid="82">Gross Profit</span></div>
                                          <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="83"></div>
                                       </div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="84" data-test="fin-col"><span data-reactid="85">21,808,900</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="86" data-test="fin-col"><span data-reactid="87">21,808,900</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="88" data-test="fin-col"><span data-reactid="89">19,605,800</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="90" data-test="fin-col"><span data-reactid="91">18,664,500</span></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Pend(10px) Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="92" data-test="fin-col"><span data-reactid="93">18,495,400</span></div>
                                    </div>
                                    <div class="D(b)" data-reactid="94"></div>
                                 </div>
                                 <div class="rw-expnded" data-reactid="95" data-test="fin-row">
                                    <div class="D(tbr) fi-row Bgc($hoverBgColor):h" data-reactid="96">
                                       <div class="D(tbc) Ta(start) Pend(15px)--mv2 Pend(10px) Bxz(bb) Py(8px) Bdends(s) Bdbs(s) Bdstarts(s) Bdstartw(1px) Bdbw(1px) Bdendw(1px) Bdc($seperatorColor) Pos(st) Start(0) Bgc($lv2BgColor) fi-row:h_Bgc($hoverBgColor) Pstart(15px)--mv2 Pstart(10px)" data-reactid="97">
                                          <div class="D(ib) Va(m) Ell Mt(-3px) W(215px)--mv2 W(200px)" data-reactid="98" title="Operating Expenses">
                                             <button class="P(0) M(0) Va(m) Bd(0) Fz(s) Mend(2px) tgglBtn" data-reactid="99">
                                                <svg class="H(16px) Fill($primaryColor) Stk($primaryColor) tgglBtn:h_Fill($linkColor) tgglBtn:h_Stk($linkColor) Cur(p)" data-icon="caret-down" data-reactid="100" height="16" style="stroke-width:0;vertical-align:bottom;" viewBox="0 0 48 48" width="16">
                                                   <path d="M24.21 33.173l12.727-12.728c.78-.78.78-2.048 0-2.828-.78-.78-2.047-.78-2.828 0l-9.9 9.9-9.9-9.9c-.78-.78-2.047-.78-2.827 0-.78.78-.78 2.047 0 2.828L24.21 33.173z" data-reactid="101"></path>
                                                </svg>
                                             </button>
                                             <span class="Va(m)" data-reactid="102">Operating Expenses</span>
                                          </div>
                                          <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="103"></div>
                                       </div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="104" data-test="fin-col"></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="105" data-test="fin-col"></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="106" data-test="fin-col"></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="107" data-test="fin-col"></div>
                                       <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Pend(10px) Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="108" data-test="fin-col"></div>
                                    </div>
                                    <div class="D(b)" data-reactid="109">
                                       <div class="rw-expnded" data-reactid="110" data-test="fin-row">
                                          <div class="D(tbr) fi-row Bgc($hoverBgColor):h" data-reactid="111">
                                             <div class="D(tbc) Ta(start) Pend(15px)--mv2 Pend(10px) Bxz(bb) Py(8px) Bdends(s) Bdbs(s) Bdstarts(s) Bdstartw(1px) Bdbw(1px) Bdendw(1px) Bdc($seperatorColor) Pos(st) Start(0) Bgc($lv2BgColor) fi-row:h_Bgc($hoverBgColor) Pstart(30px)--mv2 Pstart(25px)" data-reactid="112">
                                                <div class="D(ib) Va(m) Ell Mt(-3px) W(200px)--mv2 W(185px)" data-reactid="113" title="Research Development"><span class="Va(m)" data-reactid="114">Research Development</span></div>
                                                <div class="W(3px) Pos(a) Start(100%) T(0) H(100%) Bg($pfColumnFakeShadowGradient) Pe(n) Pend(5px)" data-reactid="115"></div>
                                             </div>
                                             <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="116" data-test="fin-col"><span data-reactid="117">985,300</span></div>
                                             <div class="D(tbc) Ta(c) P .../span></div>
                                             <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="120" data-test="fin-col"><span data-reactid="121">914,400</span></div>
                                             <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg" data-reactid="122" data-test="fin-col"><span data-reactid="123">877,100</span></div>
                                             <div class="D(tbc) Ta(c) Pstart(6px) Pend(4px) Bxz(bb) Py(8px) BdB Bdc($seperatorColor) Miw(100px) Miw(156px)--pnclg Pend(10px) Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor)" data-reactid="124" data-test="fin-col"><span data-reactid="125">849,800</span></div>
                                          </div>
                                          <div class="D(b)" data-reactid="126"></div>
                                       </div>
                                       ... Selling General and Administrative
                                       ... Total Operating Expenses
                                 ... Operating Income or Loss
                                 ... Interest Expense
                                 <!-- react-empty: 195 -->
                                 ... Income Before Tax
                                 ... Income Tax Expense
                                 ... Income from Continuing Operations
                                 ... Net Income
                                 ... Net Income available to common shareholders
                                 ... Basic EPS
                                 ... Diluted EPS
                                 ... Basic Average Shares
                                 ... Diluted Average Shares

                              </div>
                           </div>
                        </div>
                        <div class="W(8px) Pos(a) End(0) T(0) H(100%) Z(2) Bg($pfColumnFakeShadowGradientReverse) Pe(n) D(b)--sm3 D(n)" data-reactid="351"></div>
                     </div>
                  </section>
               </div>
            </div>
            <script>if (window.performance) {window.performance.mark && window.performance.mark('Col1-3-Financials');window.performance.measure && window.performance.measure('Col1-3-FinancialsDone','PageStart','Col1-3-Financials');}</script>
         </div>
      ...
      </div>
   </div>
</div>
</div>

1 respuesta 1

0

Una opción es obtener los nombres de las columnas y los datos de cada renglón para construir el DataFrame

import requests

import pandas as pd
from bs4 import BeautifulSoup


ticker = 'OR.SA'
URL = f"https://finance.yahoo.com/quote/OR.PA/financials?p={ticker}"
r = requests.get(URL) 

soup = BeautifulSoup(r.content)

d = soup.find('div', {'class': 'D(tbr) C($primaryColor)'})
columns = [x.text for x in d]

d = soup.findAll('div', {'class': 'D(tbr) fi-row Bgc($hoverBgColor):h'})
data = [[x.text for x in r] for r in d]

df = pd.DataFrame(data, columns=columns)

introducir la descripción de la imagen aquí

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.