这是themesdf的一行内容:
[{'code': '1', 'name': 'Economic management'},
{'code': '6', 'name': 'Social protection and risk management'}]
我想规范化每一行并将其添加到新的df中。这就是我现在所拥有的:
themesdf = json_df['mjtheme_namecode']
newdf = pd.DataFrame()
%timeit()
for row in themesdf:
for item in row:
newdf.append(json_normalize(item, 'name'))
newdf
在打印出newdf
之后,它一无所有。我使用此数据的最终目标是获得十大主要项目主题(列'name'
)。