Splitting a dataset into a train and test is one of the initial stages of most of the machine learning models. Following is how you can split the dataset in python:-
from sklearn.model_selection import train_test_split
X_train,X_test,Y_train,Y_test = train_test_split(dataframe_name,target_variable,test_size=0.3, random_state=42)
dataframe_name = the complete dataset as a panda dataframe
target_variable = the name of the target variable
test_size = 0.3 denotes 70-30 split of the dataset in train and test
random_state = 42, Look for the explanation in the next question