Train-Test split for Time Series Data to be used for LSTM
the syntax arr[:,:-1] selects all rows and every column except the last one. Python can use negative indexing, but it's inclusive-exclusive such as [a,b): inclusive of a, exclusive of b.
If you don't use the : operator, such as arr[:,-1], then it simply selects the entire last column.
So in the context of your example, the last column is the value to be regressed/classified/etc according to the previous columns training data.
&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; arr = np.random.randn(5,5)
&gt;&gt;&gt; print(arr)
[[-0.86690967 -0.63959234  0.99754053 -0.24828822  0.5346927 ]
 [ 0.6174709   2.16558841 -1.28983554  1.15387215  0.64630439]
 [ 0.35104248 -0.54240157  0.80377977 -0.9447689  -0.08145433]
 [ 0.61195442  0.09407687  0.39065215 -0.8887228  -1.63845254]
 [-1.58212796 -0.46017275 -0.2065184   0.44879872 -0.95037541]]
&gt;&gt;&gt; print(arr[:,:-1])
[[-0.86690967 -0.63959234  0.99754053 -0.24828822]
 [ 0.6174709   2.16558841 -1.28983554  1.15387215]
 [ 0.35104248 -0.54240157  0.80377977 -0.9447689 ]
 [ 0.61195442  0.09407687  0.39065215 -0.8887228 ]
 [-1.58212796 -0.46017275 -0.2065184   0.44879872]]
&gt;&gt;&gt; print(arr[:,-1])
[ 0.5346927   0.64630439 -0.08145433 -1.63845254 -0.95037541]

Notice that the final print is actually the last column of arr, but because it is a 1D array, it appears as a row-vector rather than column-vector.