我有一個水果數據集,其中包含名稱,顏色,重量,尺寸,種子轉移列向左大熊貓據幀
Fruit dataset
Name Colour Weight Size Seeds Unnamed
Apple Apple Red 10.0 Big Yes
Apple Apple Red 5.0 Small Yes
Pear Pear Green 11.0 Big Yes
Banana Banana Yellow 4.0 Small Yes
Orange Orange Orange 5.0 Small Yes
的問題是,顏色列名和值的重複列向右移動1列,創建一個無用的列(未命名),其中包含屬於列種子的值。是否有一種簡單的方法可以在Color中刪除重複的值,並將權重向後的列值的其餘部分向左移1列。我希望我不會在這裏混淆任何人。
慾望結果
Fruit dataset
Name Colour Weight Size Seeds Unnamed(will be dropped)
Apple Red 10.0 Big Yes
Apple Red 5.0 Small Yes
Pear Green 11.0 Big Yes
Banana Yellow 4.0 Small Yes
Orange Orange 5.0 Small Yes
非常感謝你。 –
@ Niche.P,歡迎您:) – MaxU