我有一张这样的数据库表:
id|type_id | col1 | col2 | col3
0 | 1 | 2 | b | c
1 | 2 | 1 | a | a
2 | 2 | 2 | a | c
3 | 1 | 3 | b | c
我需要写一个查询集:
[{'id':1, 'count_col1': 5, 'type_id__name':balh, 'col2':b},{'id':2, 'count_col1':3, 'type_id__name': balab, 'col2':a}]
我该怎么做?它可以在熊猫中由groupby完成,但我不知道如何在这里完成。