I have a dataframe of this kind:
import pandas as pd
df = pd.DataFrame({'condition': ['BL', 'washon', 'washoff', 'BL', 'washon', 'washoff'],
'value': [406, 219, 'NaN', 54, 16, 52]},
index = ['cell1', 'cell1', 'cell1', 'cell2', 'cell2', 'cell2'])
And I need to loop over the value column and get the percent of BL for the washon and washoff values for each cell1 and cell2 into a new column, aka
df['value_percent_BL'] = [100, 53, NaN, 100, 29, 96]
Any ideas are appreciated!