首页 > 解决方案 > Series 类型的对象不是 JSON 可序列化的

问题描述

我有数据集,我想将此数据上传到 PostgreSQL 数据库,这是数据样本,这是熊猫数据框

         key                                   changes
        LDELM27360          {'Access Control List': ['AUTO_CREATED', 'MANUAL_CREATED']}
        LDELE47148          {'Access Control List': ['AUTO_CREATED', 'MANUAL_CREATED']}
        LDELW24536          {'Access Control List': ['AUTO_CREATED', 'MANUAL_CREATED']}
        LDELE34286          {'Access Control List': ['AUTO_CREATED', 'MANUAL_CREATED']}

当我上传更改列时,它给出错误 can't upload dict which can't serializable after search on stack overflow 他们建议使用

json.dumps()

但给出错误

Object of type Series is not JSON serializable

还有其他方法可以上传这些数据吗?

标签: jsonpython-3.xpandaspostgresqlpsycopg2

解决方案


推荐阅读