简体   繁体   English

如何用 pandas 读取孟加拉语 dataframe json 文件

[英]How to read bangla dataframe json file with pandas

Here my code look like这里我的代码看起来像

import codecs
import pandas as pd
pd.read_json(codecs.open('/content/drive/MyDrive/content_colab_access/quotes_test.json', 'r', 'utf-8'))
print(data.shape)
data.head()

I have different quotes in quotes_test.json.我在 quotes_test.json 中有不同的引号。 Here some parts of dataframe are,这里 dataframe 的一些部分是,

[
    {
      "Quote": "যখন মানুষের খুব প্রিয় কেউ তাকে অপছন্দ করে না",
      "Author": "Humayun Ahmed",
      "Tags": [
        "bangladesh"," bengali"," humayun-ahmed "
      ],
      "Popularity": 0.381,
      "Category": "life"
    }
  ] 

The error i found,我发现的错误,

ValueError: Unexpected character found when decoding array value

So my question to all of you what is the right way?所以我想问大家什么是正确的方法? I want to make the output like我想让 output 像这里 Thank you.谢谢你。

The encoding is not of required type.编码不是必需的类型。

pd.read_json(codecs.open('/content/drive/MyDrive/content_colab_access/quotes_test.json', 'r', 'utf-8-sig'))

I recommend module chardet to detect encoding.我推荐模块chardet来检测编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM