我有一个看起来像这样的DataFrame:
+-------+------------------+-------------------+
| index | important_column | irrelevant_column |
+-------+------------------+-------------------+
| 1 | A | a |
| 2 | A | b |
| 3 | B | c |
| 4 | B | d |
| 5 | B | e |
| 6 | C | f |
+-------+------------------+-------------------+
我想将其转换为这样的DataFrame:
+-------+------------------+
| index | important_column |
+-------+------------------+
| 1,2 | A |
| 3,4,5 | B |
| 6 | C |
+-------+------------------+
在大熊猫中做到这一点的优雅方法是什么?