Advertisement
Vitaliy_Novichikhin

8.5.2

Feb 7th, 2022
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. import pandas
  2.  
  3. data = pandas.read_csv('support_data.csv')
  4.  
  5. segment = list(data['segment'])
  6. robocats = list(data['robocats'])
  7.  
  8. # ваш код здесь
  9. already_rc_segment_0 = 0 #обнуляем сперва все значения для счетчика
  10. already_rc_segment_1 = 0
  11. already_rc_segment_2 = 0
  12. for value in range(len(data)):
  13.     if segment[value]=='Segment 0':
  14.         already_rc_segment_0 += robocats[value] #посчитаем кол-во робокотов в кажом сегменте
  15. #    print(already_rc_segment_0)
  16.     if segment[value]=='Segment 1':
  17.         already_rc_segment_1 += robocats[value]
  18. #    print(already_rc_segment_1)
  19.     if segment[value]=='Segment 2':
  20.         already_rc_segment_2 += robocats[value]
  21. #    print(already_rc_segment_2)
  22. print(already_rc_segment_0/sum(data['duration']), already_rc_segment_1/sum(data['duration']), already_rc_segment_2/sum(data['duration']), sep='\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement