I have read many posts but not been successful. I have a column 'percent' that i wish to but in categories 1,2,3,4. the dataframe is called 'data' . I tried
for i in data.index:
    if i > 0.7:
        df.at[i,"percent"] =1
    if i <0.7 and i>0:
        df.at[i, "percent"] = 2
    if i <0 and i > -0.4:
        df.at[i, "percent"] = 3
    if i < 0.4:
        df.at[i, "percent"] = 4
but it looks like everything is replaced to 1. what am i doing wrong?
