ValueError: DataFrame constructor not properly called


  • please help me get rid of this issue


  • @MAMPI
    token you are passing as a integer 30108
    but token should be an string "30108"

    Hope this is definitely solve your issue


  • @MAMPI token may not be there in NSE

    If you are doing NFO then you have to specify NFO tokens only.

    Hope you are not trying to get some options or futures data using exchang as NSE


  • @Mnagesh

    pd.set_option('max_columns',None)
    apikey='TSOju4BH'
    username='******4'
    pwd='*******a'

    def getCandleDta(token):
    try:
    historicParam={
    "exchange": "NSE",
    "symboltoken": token,
    "interval": "THIRTY_MINUTE",
    "fromdate":"2022-06-22 09:15",
    "todate":"2022-06-27 15:30"
    }

       return obj.getCandleData(historicParam)
    except Exception as e:
        print("error")
    

    columns = ['timestamp','O','H','L','C','V']

    res_json1 = getCandleDta(30108)
    print(res_json1)
    df1=pd.DataFrame(res_json1['data'],columns=columns)
    dx2['ABFRL']=df1['C']
    df1=0

    after execution of the code above mention error is appearing,


  • @MAMPI Invalid Token error
    can you elaborate in detail with just part of your code without disclosing any login or password .

    is it occurred during login process ?

    or

    it occurred during fetching some details of your share like SBIN or so ?


  • @MAMPI {'success': False, 'message': 'Invalid Token', 'errorCode': 'AG8001', 'data': ''}