How do I categorize trend on a stacked data (python)?

Viewed 30

I have a stacked-style data frame that looked like this:

period  customer   pay
 2       John      400
 3       Doe       300
 1       Jane      100
 1       John      350
 2       Doe       250
 2       Jane      150
 3       John      145
 1       Doe       225

What I want to achieve is a new column that categorized the pay trend as a negative or positive trend. Something looked like this:

customer    pay_trend
 John       Negative
 Doe        Positive
 Jane       Positive

Thank you!

0 Answers
Related