In numpy what is the difference between these, x=train[i,:-1] and y=train[i,-1]
Doubt in numpy slicing
Hello @raushan.iitdhn,
x = train[i,:-1] #this will slice the array such that x has the ith row and all columns except the last one of train.
y = train[i,-1] #this will slice the array such that x has ith row and last column of train.
Hope this helps with your doubt.
Thanks
1 Like