Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
579 B
2
Indexable
Never
import pandas as pd
from sklearn.model_selection import train_test_split
data = pd.read_csv("your_dataset.csv")

# Split the data into features and target variable
X = data.drop(columns=["target_column"])
y = data["target_column"]

# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Print the shapes of the resulting datasets
print("Shape of X_train:", X_train.shape)
print("Shape of X_test:", X_test.shape)
print("Shape of y_train:", y_train.shape)
print("Shape of y_test:", y_test.shape)