The code below gives a ValueError: Input variables with an inconsistent number of samples were found: [8082, 5572]. Fix it! from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(tfidf, cats, test_size=0.3, random_state=42)
def split_data(df, y, test_size=0.2, random_state=42): X = df y = y X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=test_size, random_state=random_state) return X_train, X_test, y_train, y_test split_data(tfidf, cats)