<th class="txtLeft" rowspan="3">ランキング</th> <th class="txtLeft">エリア×業態ランキング</th> <th class="txtLeft" rowspan="2">業態との比較</th> <th class="txtLeft">平均PV<br/>(関東×業態)</th> <th class="txtLeft w10p" rowspan="2">エリアとの比較</th> <th class="txtLeft">平均PV</th>
beautifulsoupで取得したいtableタグのみ取得しました。
pandasで表を読み込ませたいのですが、rowspanがあるためにずれてしまいます。
下記のコードでr3とr1はtablesから削除できるのですがr2のみ削除できません。
python
1data = driver.page_source.encode() 2soup = BeautifulSoup(data, 'html.parser') 3tables = soup.find('table', attrs={'class': 'table1'}) 4 5r3 = tables.find('th', attrs={'rowspan': '3'}).extract() 6r1 = tables.find('th', attrs={'class': 'txtLeft w10p'}).extract() 7r2 = tables.find('th', attrs={'rowspan': '2'}).extract()
rowspanをすべて削除したいです。
ご教示お願い致します
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。