gpt4 book ai didi

python - 类型错误 : cannot concatenate a ninNDFrame object while trying to concat

转载 作者:行者123 更新时间:2023-11-30 09:24:54 26 4
gpt4 key购买 nike

enter image description here这是我的代码,我尝试在 axis=0 上连接或附加,但收到此错误。所有列都相同,甚至数据类型也相同。

尽管在执行 pd.read_csv() 时,我必须指定 encoding=ISO-8859-1您认为这可能是原因吗?虽然类型是数据框

declinedataforclassification=declinedata[['amount_requested','Risk_Score','dti','State','emp_length','policy_code','app_month']]
loandataforclassification=loandata[['loan_amnt','Risk_Score','dti','addr_state','emp_length','policy_code','issue_month']]
loandataforclassification=loandataforclassification.rename(columns={'loan_amnt':'amount_requested','addr_state':'State','issue_month':'app_month'})
declinedataforclassification['status']=0
loandataforclassification['status']=1
loandataforclassification['amount_requested']=loandataforclassification['amount_requested'].astype(float)

resultdata = loandataforclassification.append('declinedataforclassification',ignore_index=True)

最佳答案

resultdata = loandataforclassification.append(declinedataforclassification,ignore_index=True)

应该适合你。您现在正尝试将字符串附加到数据框。

关于python - 类型错误 : cannot concatenate a ninNDFrame object while trying to concat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47313721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com