I have got a dataframe to which I want to append a column with values depending on a column in my dataframe. My dataframe looks somewhat like this:
c1 c2 c3
x 2 z
y 5 f
c 3 r
a 11 z
Now I want to append another column c4
based on the values of c2
.
For all values between 0 and 4 I want to append "low"
, for values between 5 and 9 I want to append "medium"
and for those bigger than 10 "high"
.
c1 c2 c3 c4
x 2 z "low"
y 5 f "medium"
c 3 r "low"
a 11 z "high"
Probably the answer is quite simple, but I really can't think of something.