错误类型:TypeError: Object of type 'int64' is not JSON serializable
错误场景:对Numpy和Pandas结果进行json.dumps报错
错误分析:1. python3中没有int64这个数据类型,所有的整型都是int
2. 报错里的int64指的是<class 'numpy.int64'>,所以很有迷惑性
解决方案:转换成python3内置数据类型即可

TypeError: Object of type 'int64' is not JSON serializable的更多相关文章

  1. labelme2coco问题:TypeError: Object of type 'int64' is not JSON serializable

    最近在做MaskRCNN 在自己的数据(labelme)转为COCOjson格式遇到问题:TypeError: Object of type 'int64' is not JSON serializa ...

  2. TypeError: Object of type 'int32' is not JSON serializable ——已解决

    将模型用flask封装,返回json时报错:TypeError: Object of type 'int32' is not JSON serializable 网上搜索出的解决方案:重写json.J ...

  3. TypeError: Object of type 'int32' is not JSON serializable

    将模型用flask封装,返回json时报错:TypeError: Object of type 'int32' is not JSON serializable 网上搜索出的解决方案:重写json.J ...

  4. TypeError: Object of type 'ListSerializer' is not JSON serializable

    问题: 解决:ser.data是json数据,你想要的

  5. typeerror object of type ‘decimal‘ is not json serializable jsonify

    当使用flask的jsonify返回json数据时,由于数据库有些字段类型使用decimal,而jsonify无法处理 解决方案 导入下面的包即可解决 pip install simplejson

  6. TypeError: Object of type 'datetime' is not JSON serializable

    我的描述:我在flask框架中引用orm查数据库并返回数据,出现此类问题,如下图: 解决方案: 1.从表面意思看,就是说datetime时间类型无法被序列化.于是我百度了网上的同事的解答,大多说是时间 ...

  7. celery 4.1下报kombu.exceptions.EncodeError: Object of type 'bytes' is not JSON serializable 处理方式

    #python代码如下 from celery import Celeryimport subprocess app = Celery('tasks', broker='redis://localho ...

  8. Object of type 'ListSerializer' is not JSON serializable “listserializer”类型的对象不可JSON序列化

    Object of type 'ListSerializer' is not JSON serializable “listserializer”类型的对象不可JSON序列化 一般原因为 序列化的对象 ...

  9. Object of type 'ndarray' is not JSON serializable

    Object of type 'ndarray' is not JSON serializable import numpy as np import json arr=np.asarray([345 ...

随机推荐

  1. Software-Defined Networking:A Comprehensive Survey--Day3

    (接Day2的内容 +2s) E. Layer V: Northbound Interfaces 南行接口已经得到广泛接受(OpenFlow),但现在就定义北向接口还为时尚早,开发不同的控制器经验一定 ...

  2. mysql & java & spring transaction isolation level

    mysql /*SESSION LEVEL*/ select @@tx_isolation; /*GLOBAL LEVEL*/ select @@global.tx_isolation; select ...

  3. ehlib使用内存表的方法

    ehlib提供了一个TMemTableEh控件,这个控件不需要连接数据库就可以在ehlib中显示数据,在做一些虚的表格时比较有用. 简单的使用主要有这几个步骤: 1.添加量过控件Tdatasource ...

  4. 默认css修改

    input-------------------------------------------------- .input-item input{ width: 100%; height: 60px ...

  5. robotframework运行时后台报错UnicodeDecodeError

    win10环境下报错: Traceback (most recent call last): File "C:\Python27\lib\site-packages\robotide\con ...

  6. scheme 教程 #lang racket

    scheme 教程 #lang racket 来源  https://blog.csdn.net/yemeishenme/article/details/51471037 原文: https://le ...

  7. 【刷题】BZOJ 3653 谈笑风生

    Description 设T 为一棵有根树,我们做如下的定义: ? 设a和b为T 中的两个不同节点.如果a是b的祖先,那么称"a比b不知道 高明到哪里去了". ? 设a 和 b 为 ...

  8. 【HDU5687】Trie

    题目大意:需要维护一个支持以下操作的数据结构:(1)支持插入一个字符串(2)支持删除所有前缀等于给定字符串的单词(3)查询该数据结构中是否存在一个以给定字符串为前缀的字符串 题解:由题目可知,需要维护 ...

  9. dedecms添加文章时提示标题为空,编辑文章时编辑器空白的解决办法

    dedecms添加文章时提示标题为空,编辑文章时编辑器空白的解决办法 dedecms出现这个问题与代码无关,主要是和PHP的版本有关,用的PHP5.4,更换成PHP5.2之后就不会有这个问题了. 问题 ...

  10. ELK应用之二:Kibana显示Nginx中来访客户端IP地域分布

    在Kibana的visualize中显示Nginx访问日志客户端IP地域分布图 官网介绍: https://www.elastic.co/guide/en/beats/packetbeat/curre ...