You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: 3 columns passed, passed data had 5 columns
The error is throw from the following function
def html_to_df(html_str: str) -> pd.DataFrame:
"""Convert HTML to dataframe."""
from lxml import html
tree = html.fromstring(html_str)
table_element = tree.xpath("//table")[0]
rows = table_element.xpath(".//tr")
data = []
for row in rows:
cols = row.xpath(".//td")
cols = [c.text.strip() if c.text is not None else "" for c in cols]
data.append(cols)
return pd.DataFrame(data[1:], columns=data[0])
Where
html_str is "
☒
ANNUAL REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934
"
data[0] is "['', '', '']"
data[1] is "['', '☒', '', 'ANNUAL REPORT PURSUA...CT OF 1934', '']"
The text was updated successfully, but these errors were encountered:
I'm trying on Mac and get this error,
The error is throw from the following function
Where
The text was updated successfully, but these errors were encountered: