Given the following dataframe:
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
The resulting dataframe needs to look like this:
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
Where I'm at:
biling = circ.loc[circ['branch'] == 'BILING']
biwpl = circ.loc[circ['branch'] == 'BIWPL']
biling = biling + biwpl
If I try to print biling
:
print (biling)
Out:
branch Year Month count
0 NaN NaN NaN NaN
1 NaN NaN NaN NaN
2 NaN NaN NaN NaN
UPDATE Answered by @rafaelc. See comments. ( Thanks! )