import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def warn(*args, **kwargs): pass
import warnings
warnings.warn = warn
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import StratifiedShuffleSplit
train = pd.read_csv('..\input\train.csv')
test = pd.read_csv('..\input\test.csv')
def encode(train, test):
le = LabelEncoder().fit(train.species)
labels = le.transform(train.species)
classes = list(le.classes_)
test_ids = test.id
train = train.drop(['species', 'id'], axis=1)
test = test.drop(['id'], axis=1)
return train, labels, test, test_ids, classes
train, labels, test, test_ids, classes = encode(train, test)
train.head(5)
NameError
Traceback (most recent call last) <ipython-input-10-08166fb1df95> in <module>()
10 return train, labels, test, test_ids, classes
11
---> 12 train, labels, test, test_ids, classes = encode(train, test)
13 train.head(5)
NameError: name 'train' is not defined