text_plain_output_1.png
from sklearn.model_selection import train_test_split

import pandas as pd

import pandas as pd
messages = pd.read_csv('../input/spam-or-ham/spam.csv', usecols=['v1', 'v2'], encoding='ISO-8859-1')

messages = messages.rename(columns={'v1': 'label', 'v2': 'message'})

X = list(messages['message'])
X[:5]

y = list(messages['label'])
y[:5]

y = list(pd.get_dummies(y, drop_first=True)['spam'])
y[:5]

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)
X_train[:5]