I need help to edit my Python code below - to search the ID column and then give the max and min values for each ID and write them into 2 new columns. I tried the code below but I don't know how to write the min and max values in new columns labelled ID_Min and ID Max
Python code:
Screenshot of my table:
Python code:
1 2 3 |
for column, value in df. ID (): ID_max = df.groupby([ 'ID' ])[ 'N1' ]. max () ID_min = df.groupby([ 'ID' ])[ 'N1' ]. min () |
![[Image: 9TxI8.png]](https://i.stack.imgur.com/9TxI8.png)