I am trying to split the volume for a billing line by source. The billing line data volume is reported as one value, but I know that 55% of the volume originates from Source A, and 45% originates from Source B. How would I create new rows in my Pandas dataframe to split the row into two rows, one for each source?
I can calculate what the new volume value would be for each source and put it in new columns, but I'm not sure how to input those values into new rows.
Source A should be 55% of the Count, and Source B should be 45% of the Count.
from pandas import DataFrame
import numpy as np
before = DataFrame([{'Day': 1, 'Billing Line': 'abcdefg', 'Count': 1000},
{'Day': 2, 'Billing Line': 'abcdefg', 'Count': 2000}])
after = DataFrame([{'Day': 1, 'Billing Line': 'abcdefg', 'Count': 550, 'Source': 'a'},
{'Day': 1,'Billing Line': 'abcdefg', 'Count': 450, 'Source':'b'},
{'Day': 2,'Billing Line': 'abcdefg', 'Count': 1100, 'Source':'a'},
{'Day': 2,'Billing Line': 'abcdefg', 'Count': 900, 'Source':'b'}])