This can either be done using sklearn cross validation train_test_split method to partition the input data into train and test sets.
OR
np.random.choice() can also be used 
OR
pandas for data slicing?