gpt4 book ai didi

python - JSON 文件到数据帧转换-ValueError : Unexpected character found when decoding array value (2)

转载 作者:行者123 更新时间:2023-12-01 09:30:42 45 4
gpt4 key购买 nike

我有一个巨大的 json 文件,其格式如下:

[{"faceId": "2cb5a26a-1acc-4eb2-8c39-8e05e604f057", "faceRectangle": {"top": 
54, "left": 125, "width": 78, "height": 78}, "faceAttributes": {"smile":
0.584, "headPose": {"pitch": 0.0, "roll": -2.4, "yaw": 1.4}, "gender":
"male", "age": 34.4, "facialHair": {"moustache": 0.5, "beard": 0.6,
"sideburns": 0.3}, "glasses": "NoGlasses", "emotion": {"anger": 0.0,
"contempt": 0.003, "disgust": 0.0, "fear": 0.0, "happiness": 0.584,
"neutral": 0.413, "sadness": 0.0, "surprise": 0.0}, "blur": {"blurLevel":
"high", "value": 1.0}, "exposure": {"exposureLevel": "goodExposure",
"value": 0.61}, "noise": {"noiseLevel": "low", "value": 0.0}, "makeup":
{"eyeMakeup": false, "lipMakeup": false}, "accessories": [{"type":
"headwear", "confidence": 1.0}], "occlusion": {"foreheadOccluded": true,
"eyeOccluded": false, "mouthOccluded": false}, "hair": {"bald": 0.0,
"invisible": true, "hairColor": []}}}]

我尝试使用以下代码将其转换为数据框:

import pandas as pd
ent_json_file = 'ent.json'
reading_json = pd.read_json(ent_json_file,convert_dates=True,lines=True)

我收到以下错误:

ValueError: Unexpected character found when decoding array value (2)

非常感谢任何帮助!谢谢!

最佳答案

您的错误似乎来自无效的 JSON 格式。

我发现在线 JSON lint 是一种快速、简单的方法来了解 JSON 文件的情况:

https://jsonlint.com/

关于python - JSON 文件到数据帧转换-ValueError : Unexpected character found when decoding array value (2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49993514/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com