text_plain_output_1.png
import pandas as pd

types_dict_train = {'train_id': 'int64', 'item_condition_id': 'int8', 'price': 'float64', 'shipping': 'int8'}
train_df = pd.read_csv('../input/train.tsv', delimiter='\t', low_memory=True, dtype=types_dict_train)
types_dict_test = {'test_id': 'int64', 'item_condition_id': 'int8', 'shipping': 'int8'}
test_df = pd.read_csv('../input/test.tsv', delimiter='\t', low_memory=True, dtype=types_dict_test)

train = pd.read_table('../input/train.tsv')

train_df = train_df.rename(columns={'train_id': 'id'})

test_df = test_df.rename(columns={'test_id': 'id'})

train_test_combine = pd.concat([train_df.drop(['price'], axis=1), test_df], axis=0)

train_test_combine.category_name = train_test_combine.category_name.astype('category')
train_test_combine.item_description = train_test_combine.item_description.astype('category')
train_test_combine.name = train_test_combine.name.astype('category')
train_test_combine.brand_name = train_test_combine.brand_name.astype('category')

train_test_combine.name = train_test_combine.name.cat.codes
train_test_combine.brand_name = train_test_combine.brand_name.cat.codes
train_test_combine.item_description = train_test_combine.item_description.cat.codes
train_test_combine.category_name = train_test_combine.category_name.cat.codes

train_test_combine = train_test_combine.drop(['brand_name'], axis=1)

train_df = train_test_combine.loc[train_test_combine['is_train'] == 1]
test_df = train_test_combine.loc[train_test_combine['is_train'] == 0]

train_df = train_df.drop(['is_train'], axis=1)
test_df = test_df.drop(['is_train'], axis=1)

train_df.head()