python - ArrowInvalid:第 1 列命名的文章预期长度为 40,但长度为 35
问题描述
这是一个json文件:
{
"id": "68af48116a252820a1e103727003d1087cb21a32",
"article": [
"by mark duell .",
"published : .",
"05:58 est , 10 september 2012 .",
"| .",
"updated : .",
"07:38 est , 10 september 2012 .",
"a pet owner starved her two dogs so badly that one was forced to eat part of his mother 's dead body in a desperate attempt to survive .",
"the mother died a ` horrendous ' death and both were in a terrible state when found after two weeks of starvation earlier this year at the home of katrina plumridge , 31 , in grimsby , lincolnshire .",
"the barely-alive dog was ` shockingly thin ' and the house had a ` nauseating and overpowering ' stench , grimsby magistrates court heard .",
"warning : graphic content .",
"horrendous : the male dog , scrappy -lrb- right -rrb- , was so badly emaciated that he ate the body of his mother ronnie -lrb- centre -rrb- to try to survive at the home of katrina plumridge in grimsby , lincolnshire .",
"the suffering was so serious that the female staffordshire bull terrier , named ronnie , died of starvation , nigel burn , prosecuting , told the court last friday .",
"suspended jail term : the dogs were in a terrible state when found after two weeks of starvation at the home of katrina plumridge , 31 -lrb- pictured -rrb- .",
"the male dog , her son scrappy , was so badly emaciated that he ate her body to try to survive .",
],
"abstract": [
"neglect by katrina plumridge saw staffordshire bull terrier ronnie die .",
"dog 's son scrappy was forced to eat her to survive at grimsby house .",
"alarm raised by letting agent shocked by ` thinnest dog he 'd ever seen '",
]
}
这里有问题的片段:
from datasets import Dataset
with open('100252.json') as json_data:
data = json.load(json_data)
dataset = Dataset.from_dict(data)
这是错误:
ArrowInvalid: Column 1 named article expected length 40 but got length 35
通常, 的 json 输出dataset
应该等同于您在此问题上看到的内容。我该如何解决这个错误?
解决方案
推荐阅读
- ruby-on-rails - 如何修复共享相同 ID 的 Rails Active Storage blob
- python-3.x - 在创建具有已知不良数据的数据帧时强制执行数据类型
- python - 我不明白为什么范围函数增量参数适用于切片运算符
- .net - 我的 .Net 代码在命名管道中出现 40 错误,但 Excel 连接正常
- java - 继承中的方法调用有问题
- php - WooCommerce 在快速编辑时保存自定义产品字段
- bash - 计算机启动后 Anacrontab 未运行计划的 bash 脚本
- java - 为什么 return 不尊重 finally 块中变量的值?
- python-3.x - 如何计算分段线性斜率
- python - 抑制 GtkButton:image-spacing 的 Python matplotlib 弃用警告