Guest User

Untitled

a guest
Jan 24th, 2020
439
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. support_log_grouped['alert_group'] = support_log_grouped['user_id'].apply(alert_group)
  13. print(support_log_grouped.groupby('alert_group')['user_id'].sum())
RAW Paste Data