Apologies for what feels like an incredibly basic problem, but I couldn't actually find any answers on this. I have a straightforward function to add items (stock symbols) to a list based on their last letter. To start off I'm using a list. 'nyse' is the dataframe. The function is this:
nysewarrants = ()
def warrants(x, y):
for e in x:
if x.Symbol[e][-1] == 'W':
y.append(e)
return y
warrants(nyse, nysewarrants)
The current error is, "KeyError: 'Symbol'". I tried "print (nyse.Symbol[9][-1])" and got the expected output.
Thanks very much for any help.