To explain my problem easier I have created a dataset:
data = {'Cycle': ['Set1', 'Set1', 'Set1', 'Set2', 'Set2', 'Set2', 'Set2'],
'Value': [1, 2.2, .5, .2,1,2.5,1]}
I want to create a loop that goes through the "Cycle" column and marks the max of each cycle with the letter A and the min with letter B, to output something like this:
POI = {'Cycle': ['Set1', 'Set1', 'Set1', 'Set2', 'Set2', 'Set2', 'Set2'],
'Value': [1, 2.2, .5, .2,1,2.5,1],
'POI': [0, 'A','B','B',0,'A',0]}
df2 = pd.DataFrame(POI)
I am new to Python, so as much detail as possible would be very helpful, as well as I am not exactly sure how to go through each cycle on its own to get these values, so explaining that would be great.
Thanks