I would like to fill each row of a column of my dataframe based on the entries in another column, in particular I want to fill each row with the corresponding name of the corresponding ticker for that stock, like so
dict1 = [{'ticker': 'AAPL','Name': 'Apple Inc.'},
{'ticker': 'MSFT','Name': 'Microsoft Corporation'}]
df1 = pd.DataFrame(dict1)
This function provides the name for a given ticker:
So I can pull the name for for say MSFT:
dict1 = [{'ticker': 'AAPL','Name': 'Apple Inc.'},
{'ticker': 'MSFT','Name': get_nasdaq_symbols().loc['MSFT'].loc['Security Name'][:-15]}]
I am struggling to find a way to automate this with a for loop or apply. Can anyone suggest an approach?
Note, the function used to pull the name comes from here:
from pandas_datareader.nasdaq_trader import get_nasdaq_symbols