栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

The frame.append method is deprecated and will be removed from pandas in a future version.(pandas)

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

The frame.append method is deprecated and will be removed from pandas in a future version.(pandas)

问题解释:pandas中未来版本中要移除掉的函数。
我这里的问题是最常用的Dataframe的.append()以后要环城concat进行行的添加了。
以下给出一种能用的解决方法:
定义两个dataframe然后进行concat

og = pd.DataFrame(index=[], columns=['epoch', 'lr', 'loss'])
#随便定义些数据
a=range(2,6)
#新建一个DataFrame
tmp = pd.DataFrame({'epoch':a[0], 'lr':a[1], 'loss':a[2]},
                   index=[0],
                   columns=['epoch', 'lr', 'loss'])
 #默认是垂直添加,axis=0                  
log=pd.concat([log,tmp],ignore_index=True)
log.to_csv('testlog.csv', index=False)

参考:
里面的.append()未来的版本会消失。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/969376.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号