Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas
- data = pandas.read_csv('support_data.csv')
- segment = list(data['segment'])
- robocats = list(data['robocats'])
- # ваш код здесь
- already_rc_segment_0 = 0 #обнуляем сперва все значения для счетчика
- already_rc_segment_1 = 0
- already_rc_segment_2 = 0
- for value in range(len(data)):
- if segment[value]=='Segment 0':
- already_rc_segment_0 += robocats[value] #посчитаем кол-во робокотов в кажом сегменте
- # print(already_rc_segment_0)
- if segment[value]=='Segment 1':
- already_rc_segment_1 += robocats[value]
- # print(already_rc_segment_1)
- if segment[value]=='Segment 2':
- already_rc_segment_2 += robocats[value]
- # print(already_rc_segment_2)
- 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