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'] < 120 OR
db['Stoppage time in minutes'] > 120 & db['Stoppage time in minutes'] < 240 OR
db['Stoppage time in minutes'] > 240 & db['Stoppage time in minutes'] < 360 OR
# So Need Result like as below:
stoppage time in minutes | Activity | New Column(Time Category)
-------------------------120 | Stopped | <2 HRS
-------------------------240 | Stopped | 2 - 4 HRS
Require this solution due to a pool of high numbers of databases.