
df = pd.DataFrame({'Team': ['A', 'A', 'B'], 'score': ['90', '80', '80'],'name':['1','2','3']})
df = df.groupby("Team")['score'].apply(lambda x:",".join(x)).str.split(",",expand=True)
df = df.reset_index()
df.rename(columns={0:"分數1",1:"分數2"},inplace=True)
print(df)
print(df.columns)
合並后的某列的值是多個,但是只取第一個
risk_weights = risk_weights.groupby(['risk_type', 'risk_factor'])['risk_weight'].apply(
lambda x: x.iloc[0])
risk_weights = risk_weights.reset_index()
