我有一个称为“属性”列中的数据帧DF,下面拆分列修改数据帧
attributes
{"id":1,"firstname":"Joe","lastname":"Lee"}
{"id":12,"firstname":"Brian","lastname":"Li"}
{"id":2,"firstname":"Ron","lastname":"Stein"}
如何拆分此列到不同的列,使我的数据框现在看起来像所示 -
attributes id firstname lastname
{"id":1,"firstname":"Joe","lastname":"Lee"} 1 Joe Lee
{"id":12,"firstname":"Brian","lastname":"Li"} 12 Brian Li
{"id":2,"firstname":"Ron","lastname":"Stein"} 2 Ron Stein
我试图访问诸如
df.attributes.id
df.attributes.firstname
每个值,但我不能!您的帮助将不胜感激。
我学到新的东西,这是相当优雅。谢谢! – Uvar