栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

熊猫康卡特产生nan值

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

熊猫康卡特产生nan值

我认为索引值不同存在问题,因此

concat
无法对齐get
NaN

aaa  = pd.Dataframe([0,1,0,1,0,0], columns=['prediction'], index=[4,5,8,7,10,12])print(aaa)    prediction4 05 18 07 1100120bbb  = pd.Dataframe([0,0,1,0,1,1], columns=['groundTruth'])print(bbb)   groundTruth0 01 02 13 04 15 1print (pd.concat([aaa, bbb], axis=1))    prediction  groundTruth0          NaN          0.01          NaN          0.02          NaN          1.03          NaN          0.04          0.0          1.05          1.0          1.07          1.0          NaN8          0.0          NaN10         0.0          NaN12         0.0          NaN

解决方案是

reset_index
如果不需要索引值:

aaa.reset_index(drop=True, inplace=True)bbb.reset_index(drop=True, inplace=True)print(aaa)   prediction001120314050print(bbb)   groundTruth0 01 02 13 04 15 1print (pd.concat([aaa, bbb], axis=1))   prediction  groundTruth00 011 020 131 040 150 1


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

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

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