我怎样才能把df1变成df2?
df1 = pd.DataFrame(
{
'item1_aspect1' : ["a", "b", "c"],
'item1_aspect2' : [1,2,3],
'item1_aspect3' : ["[12,34]", "[56,78]", "[99,10]"],
'item2_aspect1' : ["a", "b", "c"],
'item2_aspect2' : [1,2,3],
'item2_aspect3' : ["[12,34]", "[56,78]", "[99,10]"],
'item3_aspect1' : ["a", "b", "c"],
'item3_aspect2' : [1,2,3],
'item3_aspect3' : ["[12,34]", "[56,78]", "[99,10]"]
})
df2 = pd.DataFrame({
'aspect_1' : ["a", "b", "c", "a", "b", "c", "a", "b", "c"],
'aspect_2' : [1,2,3,1,2,3,1,2,3],
'aspect_3' : ["[12,34]", "[56,78]", "[99,10]", "[12,34]", "[56,78]", "[99,10]", "[12,34]", "[56,78]", "[99,10]"]
})
即列名是一个标识符,它分成几行。我不知道该怎么做。
胡说叔叔
qq_笑_17
江户川乱折腾
万千封印
相关分类