From 30be17a924defa0e36fba9ebb5a71e6f3b6ef353 Mon Sep 17 00:00:00 2001 From: Damian Guenzing <65827185+gnzng@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:58:35 +0200 Subject: [PATCH] fix get_df for output in stocks/disc (#2667) * Update disc_helpers.py * fixed linters * removed whitespace * reordered imports --- openbb_terminal/stocks/discovery/disc_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openbb_terminal/stocks/discovery/disc_helpers.py b/openbb_terminal/stocks/discovery/disc_helpers.py index 42163752f60..d20b3499232 100644 --- a/openbb_terminal/stocks/discovery/disc_helpers.py +++ b/openbb_terminal/stocks/discovery/disc_helpers.py @@ -1,11 +1,15 @@ +import re import pandas as pd import requests + from openbb_terminal.helper_funcs import get_user_agent def get_df(url: str, header: int = None) -> pd.DataFrame: headers = {"User-Agent": get_user_agent()} html = requests.get(url, headers=headers).text - dfs = pd.read_html(html, header=header) + # use regex to replace radio button html entries + html_clean = re.sub(r"().*?()", "", html) + dfs = pd.read_html(html_clean, header=header) return dfs