TypeError: Object of type 'int64' is not JSON serializable
错误类型:TypeError: Object of type ‘int64’ is not JSON serializable
错误场景:对Numpy和Pandas结果进行json.dumps报错
错误分析:1. python3中没有int64这个数据类型,所有的整型都是int
2. 报错里的int64指的是<class ‘numpy.int64’>,所以很有迷惑性
解决方案:转换成python3内置数据类型即可
即如果变量i是从numpy或者pandas读取过来的整数,则使用int(i)进行转换就可以成功写入了
参考:https://www.cnblogs.com/Peter2014/p/10621140.html