Conclusion: pandas, the non-unique index unable to achieve the purpose of multiple lines selected by df.loc [index].
The data in the following example:
month | count |
1 | 1 |
1 | 2 |
2 | 3 |
2 | 4 |
If we did before to dataframe dataframe.set_index ( 'month', inplace = True) operation, the month is converted to index.
Can not be [1, 'count'] to get the child data month == 1, the code may be error keyError xxx is not unique, or by dataframe.loc.
That is: For the dataframe comprising a non-unique index can not be positioned by the label name to multiple rows of data.