開始使用免費開始

探索訓練資料

你將使用另一個 Kaggle 競賽:「Store Item Demand Forecasting Challenge」。在這個競賽中,會提供 5 年的商店—商品銷售資料,並要求你為 10 間商店中的 50 種不同商品,預測未來 3 個月的銷售量。

先從探索此競賽的訓練資料開始。為了提升效能,你將使用只包含單一月份歷史紀錄的訓練資料子集。

你的第一個目標是讀取輸入資料,並先對資料有初步的認識。

本練習屬於課程

用 Python 拿下 Kaggle 競賽

檢視課程

練習說明

  • 匯入 pandas 並命名為 pd
  • 使用 pandasread_csv() 方法讀取訓練資料。
  • 列印訓練資料的前幾筆(使用 head() 方法)以查看資料範例。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Import pandas
import ____ as pd

# Read train data
train = pd.____('train.csv')

# Look at the shape of the data
print('Train shape:', train.shape)

# Look at the head() of the data
print(train.____())
編輯並執行程式碼