So my issue is I want to get the value of the subtraction of the secondary groups for each primary group.
I applied groupby()
for two columns 'Country'
and 'doc_type'
and I want the subtraction of the values (SAL-SRT
) obtained for each Country
, using pythons pandas
Country doc_type
Afghanistan SAL 4375.0
SRT 144.0
Algeria SAL 8613.0
SRT 28.0
Australia SAL 356.0