我有一個稱爲「屬性」列中的數據幀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