Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas
- import seaborn
- data = pandas.read_csv('support_data.csv')
- segments_old = ['Segment 0', 'Segment 1', 'Segment 2']
- segments_new = ['Потенциальные клиенты', 'Обычные клиенты', 'VIP-клиенты']
- intervals = ['До внедрения роботов', 'После внедрения роботов']
- intervals_column = list(data['interval'])
- segments_column = list(data['segment'])
- duration_column = list(data['duration'])
- #print(duration_column[:10])
- mean_duration = []
- # ваш код здесь
- for segment in segments_old:
- interval_duration = []
- # вложенный цикл по двум периодам
- for interval in intervals:
- score = 0
- counter = 0
- # вложенный цикл по строкам
- for index in range(len(data)):
- if (segments_column[index] == segment and
- intervals_column[index] == interval):
- score += duration_column[index]
- counter += 1
- print(score, counter)
- interval_duration.append(score / counter)
- print(interval_duration)
- mean_duration.append(interval_duration)
- seaborn.heatmap(mean_duration, xticklabels=intervals, yticklabels=segments_new, annot=True, cmap='RdYlGn')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement