I want to ask you, How to select rows that have the same index number in a DataFrame. Example:
df=
A, B, C,
0 1. 2. 1.
1 2. 2. 2.
2 2. 2. 2.
3 3. 3. 4.
A, B, C,
0 1. 2. 1.
1 2. 2. 2.
2 2. 2. 0.
3 3. 3. 4.
A, B, C,
0 1. 2. 1.
1 2. 2. 2.
2 0. 2. 2.
3 3. 3. 4.
I expect:
df1=
A, B, C,
2 2. 2. 2.
2 2. 2. 0.
2 0. 2. 2.
I'm using df.loc[2] but only shows me the first set of data. Also used df1=df.set_index(['2']) and doesn't works too. Thanks in advance!
df.index= Out[101]: RangeIndex(start=0, stop=874, step=1)but I can see index of variable length [1,2,3,4,5,,1,2,3,,1,2,3...] and the output of my columns is:Index(['Unnamed: 0', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34'