I want to split my dataset into two parts, 75% for training and 25% for testing. There are two classes. And I have another dataset that has only one instance of one class, rest all instances belong to second class. So I dont want to split randomly. I want to make sure, if there is only one instance of one class, it should be in training. Any ideas how to do it. I know I have to select the indices, but i don't know how. Right now , I am doing this, which is selecting first 75% as training and remaining as testing
train_data = df[:int((len(df)+1)*.75)]
test_data = df[int(len(df)*.75+1):]