I have a numpy array like this:
candidates =
array([[1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1],
[1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0]])
And I do not understand what is the difference between candidates[0]
:
candidates[0] =
array([1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]
candidates[0].shape = (34,)
And candidates[0:1]
:
candidates[0:1] =
array([[1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]])
candidates[0:1].shape = (1, 34)
because I believe the two should give the exact same results? I mean the later i.e. candidates[0:1]
is supposed to represent the first element only, right? So, what is the difference between the two exactly?