I have data in an excel file, df that holds aggregated values per ID. I am looking to break this down to its distinct count and create a new record for each.
Data
A B C
2 3 1
Desired
count ID
1 A01
1 A02
1 B01
1 B02
1 B03
1 C01
Doing:
import pandas as pd
from numpy.random import randint
df = pd.DataFrame(columns=['A', 'B', 'C'])
for i in range(5):
df.loc[i] = ['ID' + str(i)] + list(randint(10, size=2))
I am thinking I can go about it this way, however, this is not stacking all the necessary IDs, consecutively.
Any suggestion or advice will be appreciated.