使用np.argwhere()打标签问题记录与index 0 is out of bounds for axis 0 with size 0

您所在的位置:网站首页 下标出界是什么意思 使用np.argwhere()打标签问题记录与index 0 is out of bounds for axis 0 with size 0

使用np.argwhere()打标签问题记录与index 0 is out of bounds for axis 0 with size 0

2023-04-24 22:34| 来源: 网络整理| 查看: 265

使用np.argwhere()打标签问题记录与index 0 is out of bounds for axis 0 with size 0 原创

wx5cf7b29acc63c 2022-07-26 10:34:22 ©著作权

文章标签 python 机器学习 人工智能 swift 自定义 文章分类 HarmonyOS 后端开发

©著作权归作者所有:来自51CTO博客作者wx5cf7b29acc63c的原创作品,请联系作者获取转载授权,否则将追究法律责任

摘要:

出现索引问题,需要先检查索引问题:

索引可能出现问题原因是:

1.自定义的列表长度不符合遍历要求

2.存在空值现象占用,需要去除空值才能进行(本文解决方式)

df.dropna( subset =['pending_cols_name'] )

问题:

IndexError: index 0 is out of bounds for axis 0 with size 0

def str2code( x:str )->int: ''' pending_cols_name:等待处理的 pd.DataFrame 中的列名 ''' tempList = MyDataFrame['pending_cols_name'].unique() result = np.argwhere( tempList == x )[0,0] return result import swifter ## apply加速工具 %time MyDataFrame['pending_cols_name'].swifter.apply( str2code ) 收藏 评论 分享 举报

上一篇:导入10G数据的SQL脚本的MySQL5.7中

下一篇:保存模型文件权限不足 PermissionError: [Errno 13] Permission denied



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3