receive value error decision tree classifier after one-hot encoding
It looks like Y is a SpareSeries as well as y_train and y_test. So when that is passed to the decision tree fit method, it only interprets those entries with label 1 as existing. According to the pandas documentation:


  We have implemented “sparse” versions of Series and DataFrame. These are not sparse in the typical “mostly 0”. Rather, you can view these objects as being “compressed” where any data matching a specific value (NaN / missing value, though any value can be chosen) is omitted.


I'm not sure why it is a sparse data structure, but you can use the to_dense method to densify it:

Y = df.iloc[:, 23].to_dense()


Edit: Danny below mentions you could just remove Sparse=True from get_dummies.