Unfortunately, investpy is no longer functional, but you can get the same thing with Yfinance
import yfinance as yf ticker_yahoo = yf.Ticker("US0378331005") print(ticker_yahoo.ticker)
so that the result will be “AAPL”