我想在另一个名为“ Subset”的数据框中创建一个名为“ SUMIFS”的新列(即Subset ['SUMIFS'] = ...),我想知道是否可以执行像SUMIFS这样的Excel。在熊猫中跨数据框进行操作。 SUMIFS的标准为:
excel =SUMIFS(AT:AT,AS:AS,AS2,AQ:AQ,AQ2,AM:AM,AM2)
DateOfOutage Tech Sites Duration Modified
8/3/2019 3G CAI0012 2
8/2/2019 2G CAI0012 3
8/3/2019 2G CAI0012 0.1
8/3/2019 3G CAI0012 0.1
8/2/2019 3G CAI0019 3
8/2/2019 2G CAI0019 115
8/2/2019 3G CAI0019 112
8/3/2019 2G CAI0024 178
8/3/2019 3G CAI0024 175
8/2/2019 2G CAI0024 34
8/2/2019 2G CAI0024 449
8/2/2019 3G CAI0024 442
data['Duration Modified'][(data['Sites']==data['Tech'] == data['DateOfOutage'])].sum()
DateOfOutage Tech Sites Duration Modified Sumifs
8/3/2019 3G CAI0012 2 2.1
8/2/2019 2G CAI0012 3 3
8/3/2019 2G CAI0012 0.1 0.1
8/3/2019 3G CAI0012 0.1 2.1
8/2/2019 3G CAI0019 3 115
8/2/2019 2G CAI0019 115 115
8/2/2019 3G CAI0019 112 115
8/3/2019 2G CAI0024 178 178
8/3/2019 3G CAI0024 175 175
8/2/2019 2G CAI0024 34 483
8/2/2019 2G CAI0024 449 483
8/2/2019 3G CAI0024 442 442