Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将包含表情符号的JSON读入数据帧_Python_Pandas_Emoji - Fatal编程技术网

Python 将包含表情符号的JSON读入数据帧

Python 将包含表情符号的JSON读入数据帧,python,pandas,emoji,Python,Pandas,Emoji,我收到UTF-8编码的JSON文件,类似于 [ { "FieldA": "regular string 1", "FieldB": "... \ud83e\uddc0" }, { "FieldA": "regular string 2", "FieldB": "... \ud83d\ude0d" } ] 我试着用英语读它 df = pd.read_json(file_path, orient="co

我收到UTF-8编码的JSON文件,类似于

[
    {
        "FieldA": "regular string 1",
        "FieldB": "... \ud83e\uddc0"
    },
    {
        "FieldA": "regular string 2",
        "FieldB": "... \ud83d\ude0d"
    }
]
我试着用英语读它

df = pd.read_json(file_path, orient="columns", encoding="utf-8")
但我无法阅读表情符号。有什么建议吗


提前谢谢。

您可以使用
json
json\u normalize

导入json
从pandas.io.json导入json_规范化
j=[
{
“FieldA”:“常规字符串1”,
“字段B”:“..\ud83e\uddc0”
},
{
“FieldA”:“常规字符串2”,
“字段B”:“…\ud83d\ud0d”
}
]
s=json.dumps(j)#转换为字符串(将j序列化为json格式的字符串)
j2=json.loads(s)#将s反序列化为python对象
df=json_规范化(j2)#加载到数据帧
FieldA FieldB
0常规字符串1。。。