[英]How to read bangla dataframe json file with pandas
這里我的代碼看起來像
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()
我在 quotes_test.json 中有不同的引號。 這里 dataframe 的一些部分是,
[
{
"Quote": "যখন মানুষের খুব প্রিয় কেউ তাকে অপছন্দ করে না",
"Author": "Humayun Ahmed",
"Tags": [
"bangladesh"," bengali"," humayun-ahmed "
],
"Popularity": 0.381,
"Category": "life"
}
]
我發現的錯誤,
ValueError: Unexpected character found when decoding array value
編碼不是必需的類型。
pd.read_json(codecs.open('/content/drive/MyDrive/content_colab_access/quotes_test.json', 'r', 'utf-8-sig'))
我推薦模塊chardet來檢測編碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.