Slicing of training data

how to do slicing for X and Y

You can use Pandas for reading csv file and manipulating it according to your requirements.