I'm working with a DataFrame and after doing some changes in the DataFrame(in fact drop some rows).Then I select a column to make a list of lists and then try to work on it. So the code is
st_or = list (Nsetg['Aip'][k:k+2] for k in range (0, len(Nsetg['Aip'])-1, 1)) # Nsetg is the DataFrame modified,so I select the column 'Aip'
But in the list I have to drop some duplicate elements, I have some code to do this and the first thing is sort the list, which give me an exception :
st_or.sort()
"Can only compare identically-labeled Series objects"
I think the problem is because the index of the elements in the list, I'm quite sure, but if I try to print the list I get something like this : `
print st_or
[0 0
1 1
Name: Aip, dtype: int64, 1 1
2 2
Name: Aip, dtype: int64, 2 2
3 4
Name: Aip, dtype: int64, 3 4
4 6
Name: Aip, dtype: int64]
What I was expecting to get after print the list is:
[[0,1],[1,2],[2,4],[4,6], ...,]
How can I get a better result ?