Skip to content

Instantly share code, notes, and snippets.

@khuangaf
Last active May 11, 2019 15:11
Show Gist options
  • Save khuangaf/f8c9ba02294071f699340f3670c6eb1f to your computer and use it in GitHub Desktop.
Save khuangaf/f8c9ba02294071f699340f3670c6eb1f to your computer and use it in GitHub Desktop.
from sklearn.preprocessing import LabelEncoder
df = pd.read_csv('../input/yoochoose-click.dat', header=None)
df.columns=['session_id','timestamp','item_id','category']
buy_df = pd.read_csv('../input/yoochoose-buys.dat', header=None)
buy_df.columns=['session_id','timestamp','item_id','price','quantity']
item_encoder = LabelEncoder()
df['item_id'] = item_encoder.fit_transform(df.item_id)
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment