I have one dataframe enter image description here
I have created a dictionary:
Uplift = { 1: 'Significant', 0: 'Insignificant', 0.5: 'Poor' }
I want to change 1 to Significant, 0 to Insignificant and 0.5 to Poor for a particular column say the Uplift adjacent to Sales. I have tried this:
Sales_Uplift.iloc[0:1,2:3].apply(Uplift.values())
but getting error:
AttributeError: 'Significant' is not a valid function for 'Series' object
and also tried
if Sales_Uplift[(Sales_Uplift['Uplift'] == 1) | (Sales_Uplift[' Uplift'] == 1) | (Sales_Uplift[' Uplift'] == 1)]: 'Significant' elif Sales_Uplift[(Sales_Uplift['Uplift'] == 0) | (Sales_Uplift[' Uplift'] == 0) | (Sales_Uplift[' Uplift'] == 0)] : 'Insignificant' else: Poor
but getting error:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().