I want to replace each range in the dataset to a certain value
for ex:
0 - 0.3333 replace it to 1
0.33334 - 0.6666 replace it to 2
0.66667 - 0.9999 replace it to 3
code (didnt work):
a = 0 < df < 0.3333 b = 0.3334 < df < 0.666 c = 0.6667 < df < 0.9999 df df.replace(a,1) df = df.replace(b,2) df = df.replace(c,3)
I did it for one column and it worked, but I want to do it for the whole data set at once:
`df.loc[df["POS_D1"] < 0.3333, "POS_D1"] = 1 df.loc[df["POS_D1"] < 0.6666, "POS_D1"] = 2
df.loc[df["POS_D1"] < 0.9999, "POS_D1"] = 3`