Error using decision tree regressor
The problem is with the y value.

x=dataset.iloc[:,:-1].values -&gt; selecting all columns but last #this one is fine

y=dataset.iloc[:,:2].values -&gt; selecting all columns till 2nd #this one is wrong


Change this to : 

y=dataset.iloc[:,2].values #selecting only 2nd column.