0
我有以下代碼:鏈接aggreggation程序
myData_agg = myData.groupby("Customer")["PurchAmount"].sum()
myData_agg.loc[myData_agg>=100,]
我可以寫一個程序代碼? 謝謝!
我有以下代碼:鏈接aggreggation程序
myData_agg = myData.groupby("Customer")["PurchAmount"].sum()
myData_agg.loc[myData_agg>=100,]
我可以寫一個程序代碼? 謝謝!
選項之一:
鏈它們與[]
和lambda
表達式:
myData.groupby("Customer")["PurchAmount"].sum()[lambda x: x >= 100]
方法二:
使用compress
方法:
myData.groupby("Customer")["PurchAmount"].sum().compress(lambda x: x >= 100)
方案三:
使用pipe
:
myData.groupby("Customer")["PurchAmount"].sum().pipe(lambda x: x[x >= 100])