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!