I have dataframe like df=
S A4 P
0 1 3 7
1 1 5 4
2 1 7 5
3 1 10 6
4 3 12 2
5 3 15 3
6 3 1 7
7 2 2 4
8 2 3 5
9 2 4 6
10 2 5 2
11 4 6 3
I am trying to extract A4 column to numpy array and handle a 2d numpy array which has spesific row number. Row number is coming from the value count of S column. The array that i am searching is
[[3, 5, 7, 10], [12, 15, 1], [2, 3, 4, 5], [6]]
What can be the most pythonic way?