Skip to content

Instantly share code, notes, and snippets.

@ModMaamari
Created September 28, 2018 23:40
Show Gist options
  • Save ModMaamari/286f0a83b4c817d1c09f2a94362878f7 to your computer and use it in GitHub Desktop.
Save ModMaamari/286f0a83b4c817d1c09f2a94362878f7 to your computer and use it in GitHub Desktop.
def get_data():
#get train data
train_data_path ='train.csv'
train = pd.read_csv(train_data_path)
#get test data
test_data_path ='test.csv'
test = pd.read_csv(test_data_path)
return train , test
def get_combined_data():
#reading train data
train , test = get_data()
target = train.SalePrice
train.drop(['SalePrice'],axis = 1 , inplace = True)
combined = train.append(test)
combined.reset_index(inplace=True)
combined.drop(['index', 'Id'], inplace=True, axis=1)
return combined, target
#Load train and test data into pandas DataFrames
train_data, test_data = get_data()
#Combine train and test data to process them together
combined, target = get_combined_data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment