探索訓練資料
你將使用另一個 Kaggle 競賽:「Store Item Demand Forecasting Challenge」。在這個競賽中,會提供 5 年的商店—商品銷售資料,並要求你為 10 間商店中的 50 種不同商品,預測未來 3 個月的銷售量。
先從探索此競賽的訓練資料開始。為了提升效能,你將使用只包含單一月份歷史紀錄的訓練資料子集。
你的第一個目標是讀取輸入資料,並先對資料有初步的認識。
本練習屬於課程
用 Python 拿下 Kaggle 競賽
練習說明
- 匯入
pandas並命名為pd。 - 使用
pandas的read_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.____())