给出以下数据框:
branch Year Month count
BILING 2017 8 1871
BILING 2018 8 1208
BILING 2019 8 4
BILWPL 2017 8 109
BILWPL 2018 8 131
BILWPL 2019 8 84
BRANCHB 2017 8 1871
BRANCHB 2018 8 1208
BRANCHB 2019 8 4
生成的数据框应如下所示:
branch Year Month count
BILING 2017 8 1980
BILING 2018 8 1339
BILING 2019 8 88
BRANCHB 2017 8 1871
BRANCHB 2018 8 1208
BRANCHB 2019 8 4
我在哪里:
biling = circ.loc[circ['branch'] == 'BILING']
biwpl = circ.loc[circ['branch'] == 'BIWPL']
biling = biling + biwpl
如果我尝试打印biling
:
print (biling)
出局:
branch Year Month count
0 NaN NaN NaN NaN
1 NaN NaN NaN NaN
2 NaN NaN NaN NaN
更新,由@rafaelc回答。看评论。 (谢谢!)