I am writing a program which predicts stock prices and I need to search a dictionary that I have created filled with names of companies and the ticker names of the companies which is what I need to return to use Quandl to retrieve the stock prices.
Here is how I created the dictionary:
cnames= pd.read_csv('secwiki_tickers.csv')
cnamesDict= pd.Series(cnames.Ticker.values, index=cnames.Name).to_dict()#Fills a dictionary with the
csv file keys are company names values are ticker names
here is how I'm searching the dictionary and getting TypeError: argument of type 'float' is not iterable
error:
user_cname = input("Which company would you like to predict stock prices for?\n")
def searchForName(dictToSearch, lookup):
for k,v in dictToSearch.items():
if user_cname in k: // here is where the error flags
return v
print(searchForName(cnamesDict, user_cname))
Any help is appreciated. CSV file linkLINK