黃金時代
在這個練習中,你會繼續進行書籍專案。現在,你要分析「黃金時代」的書。
在檢查後,你發現資料集 golden_age 需要重新塑形。你注意到有些欄位名稱有相同的前綴(stub names),並且找出了其他可作為唯一 ID 的欄位。
因此,你會用幾種方式重塑你的 DataFrame。請依照每個指示搭配使用 wide_to_long() 函式。
資料集 golden_age 已提供給你。它包含每本書的 title、authors,以及通用識別碼 ISBN 和各國前綴的相關資料。
本練習屬於課程
使用 pandas 重塑資料
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Reshape wide to long using title as index and version as new name, and extracting isbn prefix
isbn_long = pd.____(____,
stubnames=____,
i=____,
j=____)
# Print isbn_long
print(isbn_long)