AttributeError: 'numpy.ndarray' object has no attribute 'index'
来源:互联网 发布:甲骨文数据库培训 编辑:程序博客网 时间:2024/06/05 08:26
当我在运行阿里云PAI代码的时候,预测代码会报错,查了资料才发现numpy居然没有index,python学得还是蛮痛苦和纠结的
错误的代码:
print ("This is a %s"%(num[prediction[0].index(max(prediction[0]))]))正确的代码为:
print ("This is a %s"%(num[prediction[0].tolist().index(max(prediction[0]))]))
【玩转数据系列十】利用阿里云机器学习在深度学习框架下实现智能图片分类,
链接 :https://yq.aliyun.com/articles/72841?spm=5176.100239.0.0.aLlJGY
参考文献
[1].
How to find the index of an array within an array
https://stackoverflow.com/questions/21488005/how-to-find-the-index-of-an-array-within-an-array
阅读全文
0 0
- AttributeError: 'numpy.ndarray' object has no attribute 'index'
- 关于AttributeError:'numpy.ndarray' object has no attribute 'index'
- AttributeError: 'numpy.ndarray' object has no attribute 'value_counts'
- 'numpy.ndarray' object has no attribute 'values'
- Python 保存数组至.mat文件,报错:AttributeError: 'numpy.ndarray' object has no attribute 'items'
- AttributeError: 'classmethod' object has no attribute '__module__'
- AttributeError: 'module' object has no attribute 'getpass'
- AttributeError: ‘NoneType’ object has no attribute ‘clone’
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'NoneType' object has no attribute 'clone'
- AttributeError: 'tuple' object has no attribute 'Multi'
- AttributeError: 'Response' object has no attribute 'json'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'Connection' object has no attribute 'connection_errors'
- AttributeError: 'module' object has no attribute 'randint'
- AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
- AttributeError: 'WebDriver' object has no attribute
- AttributeError: 'NoneType' object has no attribute
- 使用docker创建python3.5
- spring data jpa @Query注解中delete语句报错 : @Modifying注解的使用
- Java Web 实现导航栏 active 状态随着页面自动切换
- jQuery 实现图片下载代码
- SpringBoot SpringMVC实现文件下载
- AttributeError: 'numpy.ndarray' object has no attribute 'index'
- 哪本最具影响力的书,是每个程序员都应该读的?
- 阿里云智能对话分析服务使用教程
- Thread.sleep() 和 Thread.yield() 区别
- 微信公众号、地图定位、获取地理位置
- 并发安全的 ConcurrentHashMap 实现原理详解
- 深度学习之基础模型---AlexNet
- DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
- 图解算法练习--快速排序(GO实现)