DEV Community

evileyelivelx
evileyelivelx

Posted on

Pandas: Iterate and insert column with conditions within groups complex question

I have a quite complex question about how to add a new column with conditions for each group. Here is the example dataframe,

df = pd.DataFrame({
    'id': ['AA', 'AA', 'AA', 'AA', 'BB', 'BB', 'BB', 'BB', 'BB'
           'CC', 'CC', 'CC', 'CC', 'CC', 'CC', 'CC'],
    'From_num': [80, 68, 751, 'Issued', 32, 68,

Top comments (0)