I have a numpy array as following:
array([[1, 2],
[3, 4],
[5, 6],
[7, 8]])
The array is called myArray, and I perform two indexing operations on the 2D array and get following results:
In[1]: a1 = myArray[1:]
a1
Out[1]:array([[3, 4],
[5, 6],
[7, 8]])
In[2]: a2 = myArray[:-1]
a2
Out[2]:array([[1, 2],
[3, 4],
[5, 6]])
Now, I have the same data in the form of a pandas df in two columns, let the data frame be df
x y
0 1 2
1 3 4
3 5 6
4 7 8
How to do the equivalent indexing/ slicing on two columns to get the same results as above for a1 and a2.
df.values.