INNER CODE UNIT · Python
remove_html_tables
lefterisloukas/edgar-crawler · extract_items.py:371
def remove_html_tables(self, doc_report: str, is_html: bool) -> str:
"""
Remove HTML tables that contain numerical data
Note that there are many corner-cases in the tables that have text data instead of numerical
Args:
doc_report (str): The report html
is_html (bool): Whether the document contains html code or just plain text
Returns:
str: The report html without numerical tables
"""
if is_html:
tables = doc_report.find_all("table")
# Detect tables that have numerical data
for tbl in tables:
tbl_text = ExtractItems.clean_text(ExtractItems.strip_html(str(tbl)))