Python Pandas NameError: name data is not defined

Python Pandas NameError: name data is not defined

Dont use tryexceptpass because will silence all your exceptions and you might never actually create `data.

Replace this code:

for e in enumerate(fsym):
    print(e[0], e[1])
    if(e[0] == 0):
        try:
            data = fetchCryptoClose(e[1], tsym)
        except:
            pass
    else:
        try:
            data = data.join(fetchCryptoClose(e[1], tsym))
        except:
            pass

with this:

for e in enumerate(fsym):
    print(e[0], e[1])
    if(e[0] == 0):
        data = fetchCryptoClose(e[1], tsym)
    else:
        data = data.join(fetchCryptoClose(e[1], tsym))

and see where your real exceptions are.

Python Pandas NameError: name data is not defined

Leave a Reply

Your email address will not be published.