The answer by pcko1 is correctuseful in the sense that it will make the code run. But what you exactly require to do is one hot encoding. I say that because if encoding the categorical variables that are nominal with increasing numbers like 1, 2, 3 etc. does not make sense. Have a look at this question.
You need to encode all the categorical variables as 0-1. By that I mean, attach one column for each categorical variable in the data set, denoting its presence by a 1 and absence by a 0 in the respective rows of the data set.
#I don't know why he did this one
That has been done to have a separate data set for testing the model after it has been trained over the training set.
Just a reminder.
I am trying to copy a code from a video to do a decision tree program, which will predict if a student will pass or not depending on 30 parameters given.
The correct term should be variables not parameters.