Search code examples
python-3.xpandas-datareader

Company name for ticker symbol


Is it possible to get the company name for the ticker from pandas datareader. Such as i can use this code which will output the data for the company:data = web.DataReader(stock, 'yahoo',start, end). How can i get the ticker name Fb for Facebook?

If pandas-datareader does not offer this what can i do to get the name of the company?


Solution

  • Try this:

    import yfinance as yf
    
    pg = yf.Ticker("PG")
    
    print("Short Name: " + pg.info['shortName'])
    print("Long Name: " + pg.info['longName'])
    

    Result:

    Short Name: Procter & Gamble Company (The)

    Long Name: The Procter & Gamble Company