How to performe math in between 2 values of dictionary python -
can 1 me on below: have dictionary includes 2 metrics called impression , clicks calculate metric called ctr need perform clicks/impression*100.
so below statement helps.
to impressions :
self.campaigndict[campaignid]['impressions'] = reexp.match(line).group(1)
to clicks :
self.campaigndict[campaignid]['clicks'] = reexp.match(line).group(1)
to ctr:
`self.campaigndict[campaignid]['ctr'] = self.campaigndict[campaignid][`clicks]/self.campaigndict[campaignid][impressions]*100
let me know if correct or if has changed.
regards, sarath
Comments
Post a Comment