It’s just NumPy array slicing. You get a slice of NumPy array by passing different values arr[v1, v2, v3, …] according to the dimension of your data. Here colon means all values across that dimensions. Consider rows as first dimension and columns as the second dimension in your data:

xy[:, 0:-1]: will get you all rows (colon) and all columns except the last column (0:-1).
xy[:, [-1]]: will get you all rows (colon) and last columns ([-1]).

I hope it helps.