Generation

generate functionMon, 27 Mar 2023

There is a dataframe df with two columns: Category and Message in the following format: Category Message 0 ham Go until jurong point, crazy... Available only ... 1 ham Ok lar... Joking wif u oni... 2 spam Free entry in 2 a wkly comp to win FA Cup fina... 3 ham U dun say so early hor... U c already then say... 4 ham Nah I don't think he goes to usf, he lives aro... Split it into samples X = df['Message'] y = df['Category'] so that there are float numbers instead of object text everywhere.

def split_dataframe(df): X = df['Message'] y = df['Category'] return X, y split_dataframe(df)

Questions about programming?Chat with your personal AI assistant