分组聚合
import pandas as pd
#
a = [
{"name": 'tom', "age": '18'},
{"name": "jack", "age": "42"},
{"name": "lily", "age": "18"}]
df = pd.DataFrame(sccode_list)
res = [{"key":list(k),"rc_code":g["rc_code"].tolist()} for k, g in df.groupby(['appid','service_code','service_name'])]
#
print(res)