運用 pivot 方法來過人
現在繼續使用 fifa_players 資料集。你在探索後發現,這個資料集包含球員在不同動作上的評分:射門(shooting)、盤帶(dribbling)、傳球(passing)。同時也有進攻分數與整體分數。
這個專案的目標是分析評分以組出最佳化的陣容,所以你想先看看哪一種分數更能代表實力。不過目前的資料是長格式。你需要用不同的方式對 DataFrame 做樞紐轉換(pivot),才能找出規則。
fifa_players 資料集已可使用。請先在主控台檢視它!
本練習屬於課程
使用 pandas 重塑資料
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Pivot fifa_players to get overall scores indexed by name and identified by movement
fifa_overall = fifa_players.____(____=____, ____=____, ____=____)
# Print fifa_overall
print(fifa_overall)