TypeError: 在尝试连接时无法连接一个非NDFrame对象

输入图片描述这是我的代码,我试图在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']=0loandataforclassification['status']=1loandataforclassification['amount_requested']=loandataforclassification['amount_requested'].astype(float)resultdata = loandataforclassification.append('declinedataforclassification',ignore_index=True)

回答:

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

应该对你有用。你现在正试图将一个字符串追加到一个数据框中。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注