Advertisement
korenizla

задача3

Feb 10th, 2022
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import pandas as pd
  2. support_log = pd.read_csv('/datasets/support_log.csv')
  3. support_log_grouped = support_log.groupby('type_id').count()
  4.  
  5. def alert_group(messages):
  6.     if messages <= 300:
  7.         return 'средний'
  8.     if messages <=500:
  9.         return 'высокий'
  10.     return 'критичный'
  11.  
  12. #print(alert_group(10))
  13. #print(alert_group(450))
  14. #print(alert_group(1000))
  15.  
  16. support_log_grouped['alert_group'] = support_log_grouped['user_id'].apply(alert_group)
  17. print(support_log_grouped.head(10))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement