三张表;train_set.csv;test_set.csv;feature.csv。三张表通过object_id关联。
<pre name="code" class="python"><strong><span style="font-size:18px;">import pandas as pd import numpy as np # load training and test datasets train = pd.read_csv('../input/train_set.csv') test = pd.read_csv('../input/test_set.csv') features = pd.read_csv('../input/feature.csv') train = pd.merge(train,features,on='object_id',how='inner') test = pd.merge(test,features,on='object_id',how='inner') # drop useless columns and create labels test = test.drop(['id', 'object_id'], axis = 1) labels = train.cost.values train = train.drop(['object_id', 'cost'], axis = 1)</span></strong>
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-05 01:07:13