问题:pandas中DataFrame数据拼接报错)FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. df = df1.append(df2)

sample = known_associations.append(random_negative)

解决:

sample_df = pd.concat([known_associations, random_negative], ignore_index=True)


总结

sample_df = pd.concat([known_associations, random_negative], ignore_index=True)

#等价于

sample = known_associations.append(random_negative)

sample.reset_index(drop=True, inplace=True)

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐