Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Help with Pandas pd.read_html

Hi

I need some help with Pandas pd.read_html

I have this code that takes the Income Statement table from a specific Company ticker

import pandas as pd
from bs4 import BeautifulSoup
import requests


def getfinancialsdfy(ticker, price, com_name):  

    urlfinancials = 'https://www.marketwatch.com/investing/stock/'+ticker+'/financials'

    tables = pd.read_html(urlfinancials)
    tables_a = pd.DataFrame(tables[4])
    display(tables_a)


ejecutar = getfinancialsdfy("AA",22.1, "Alcoa Corp.") 

It’s working fine except that it duplicates the text in the first text column:

Something that is not shown in the original page table:

Anybody knows why and how to solve this issue? :thinking:

Thanks!