df = pd.DataFrame(np.random.randn(4, 3), index=['a', 'a', 'b', 'b'])
df
[out]:
0 | 1 | 2 | |
---|---|---|---|
a | 1.165314 | 0.024401 | 3.098279 |
a | -1.396526 | -1.189734 | -0.458885 |
b | 0.127144 | 0.099760 | 0.396549 |
b | -0.020434 | -0.206293 | 1.811827 |
df.loc['b']
0 | 1 | 2 | |
---|---|---|---|
b | 0.127144 | 0.099760 | 0.396549 |
b | -0.020434 | -0.206293 | 1.811827 |
df.iloc[2:4]
0 | 1 | 2 | |
---|---|---|---|
b | 0.127144 | 0.099760 | 0.396549 |
b | -0.020434 | -0.206293 | 1.811827 |