Replacing column values in pandas with specific column with multiple database operation? Need to replace database of the column in specific refine query with multiple operations as mention in below image. Trying such operation as an individual, but can't understand which method to use can make in one column with multiple operations.

Using Boolean methods to justify results but how can I do in one line code of python to get a replacement of refining/ categorized values to a specific column.


  import pandas as pd
         db = pd.read_csv('Database Path')
         db.head(2)


stoppage time in minutes  | Activity
-------------------------120 | Stopped
-------------------------240 | Stopped

#Need to refine below code for specific requirement as mention above:

db['New Column(Time Category)'] = 

db['Stoppage time in minutes'] &lt; 120 OR
db['Stoppage time in minutes'] > 120 &amp; db['Stoppage time in minutes'] &lt; 240 OR
db['Stoppage time in minutes'] > 240 &amp; db['Stoppage time in minutes'] &lt; 360 OR

# So Need Result like as below:

stoppage time in minutes  | Activity | New Column(Time Category)
-------------------------120 | Stopped  | &lt;2 HRS 
-------------------------240 | Stopped  | 2 - 4 HRS 



Require this solution due to a pool of high numbers of databases.
You can use the python ternary operator with list comprehension:

df['Buckets(HRS)'] =
 ['&lt;2hrs' if x&lt;=120 else '2-4' if 120&gt;x&lt;=240 else '4-6' if 240&gt;x&lt;=360 else '&gt;6' for x in db['Stoppage time in minutes']]