FutureWarning: Deprecation of frame.append method in pandas

问题: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)

物联沃分享整理
物联沃-IOTWORD物联网 » FutureWarning: Deprecation of frame.append method in pandas

发表评论