`.head()` 方法
一次看見完整資料很難閱讀,特別是當你有 10,000 列同時印到主控台時,更是一點也不好讀!
若要快速顯示資料開頭的幾列,可以使用 .head() 方法。
本練習屬於課程
給試算表使用者的 Python
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import the pandas package as pd
import pandas as pd
# Read in the Excel file
sales = pd.read_excel('ticket_sales.xlsx')
# Print first 5 rows of the DataFrame
print(sales.____())