Error: pandas hashtable keyerror

后端 未结 3 1050
温柔的废话
温柔的废话 2020-11-22 01:00

I have successfully read a csv file using pandas. When I am trying to print the a particular column from the data frame i am getting keyerror. Hereby i am sharing the code w

3条回答
  •  迷失自我
    2020-11-22 01:33

    dfObj['Hash Key'] = (dfObj['DEAL_ID'].map(str) +dfObj['COST_CODE'].map(str) +dfObj['TRADE_ID'].map(str)).apply(hash)
    
    #for index, row in dfObj.iterrows():
    #        dfObj.loc[`enter code here`index,'hash'] = hashlib.md5(str(row[['COST_CODE','TRADE_ID']].values)).hexdigest()
    
    print(dfObj['hash'])
    

提交回复
热议问题