I have a pandas dataframe that looks like this:
portion used
0 1 1.0
1 2 0.3
2 3 0.0
3 4 0.8
I'd like to create a new column based on the used column, so that the df looks like this:
portion used alert
0 1 1.0 Full
1 2 0.3 Partial
2 3 0.0 Empty
3 4 0.8 Partial
- Create a new
alertcolumn based on - If
usedis1.0,alertshould beFull. - If
usedis0.0,alertshould beEmpty. - Otherwise,
alertshould bePartial.
What's the best way to do that?
