0

I have pandas datframe df with columns Speed, Fall Rate and Hit Rate.

I want to classify these 3 columns them into classes( create new class Columns for each ) based on the condition described below.If the values are fall in the comes in that range .

Speed    Speed Class Fall Rate  Fall Class  Hit rate       Hit Class
<=38        Green    <2.5       Green       0 <=0.5        Green
>39 <= 74   Green  >2.5 <=7.6   Green     >0.5 <=1.2       Green
>74 <=117   Yellow    >7.6 <=10 Yellow      >1.2 <=1.4     Yellow
>117        Red     >10         Red      >1.4              Red

Sample Input

enter image description here

Expected Output

enter image description here

aeapen
  • 871
  • 1
  • 14
  • 28

0 Answers0