<分区> 分区>
Dict = {'type': 'book', 'text_eng': 'National accounts', 'text': 'Volkswirtschaftliche Gesamtrechnungen', 'anchor': 'GESAMTVOLK'}
pd.DataFrame(Dict)
pd.DataFrame.from_dict(Dict)
上面的脚本抛出错误:“ValueError:如果使用所有标量值,则必须传递一个索引”
我需要字典键作为 DataFrame 列和行中的字典值。
下面的脚本工作正常,因为字典值添加为列表
Dict = {'type': ['book'], 'text_eng': ['National accounts'], 'text': ['Volkswirtschaftliche Gesamtrechnungen'], 'anchor': ['GESAMTVOLK']}
请让我知道如何实现这一点?
