[Python] If using all scalar values, you must pass an index error when changing API into string

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to hide my API key as I want to share my code in a repo. Unfortunately, my attempt at representing my API as a string automatically mucks up my ability to turn my get request into a data frame. I find this weird as when I would initially just have my API code in the get request instead of 'API' as the representation of my API it would work totally fine. What is the issue here?


    API = os.getenv('API_KEY')

    IQ = requests.get('https://financialmodelingprep.com/api/v3/stock-screener?marketCapMoreThan=1&dividendMoreThan=0&limit=100000000&&apikey=API').json()

    Stocks = pd.DataFrame(IQ) Stocks.set_index("symbol", inplace = True)```

    response:
    If using all scalar values, you must pass an index

    Continue reading...

Compartilhe esta Página