Создаем столбец с меткой выброса dfpbometric['isoutlier'] =…
- User
Создаем столбец с меткой выброса
df_pbo_metric['is_outlier'] = df_pbo_metric['part_of_tourist_visits'] > upper_bound
Строим график (упрощаем hover_data и убираем связь цвета с подсказкой)
fig = px.scatter( df_pbo_metric, x=df_pbo_metric.index, y='part_of_tourist_visits', color='is_outlier', color_discrete_map={True: 'red', False: 'blue'}, title=f'Все точки с выделенными выбросами (порог: {upper_bound:.2f})', labels={'part_of_tourist_visits': 'Доля визитов'}, hover_data={ 'city_name': True, 'region_name': True, 'Регион': True, 'Название ПБО': True, 'pbo_location_id': True, 'is_outlier': False, # Полностью исключаем df_pbo_metric.index.name: False } )
Добавляем линию порога
fig.add_hline( y=upper_bound, line_dash="dot", line_color="green", annotation_text=f"Порог выбросов: {upper_bound:.2f}", annotation_position="top right" )
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.