vivainsights.keymetrics_scan¶
Generate a heatmap or summary table scanning key Viva Insights metrics.
- vivainsights.keymetrics_scan.keymetrics_scan(data, hrvar='Organization', mingroup=5, metrics=['Workweek_span', 'Collaboration_hours', 'After_hours_collaboration_hours', 'Meetings', 'Meeting_hours', 'After_hours_meeting_hours', 'Low_quality_meeting_hours', 'Meeting_hours_with_manager_1_on_1', 'Meeting_hours_with_manager', 'Emails_sent', 'Email_hours', 'After_hours_email_hours', 'Generated_workload_email_hours', 'Total_focus_hours', 'Internal_network_size', 'Networking_outside_organization', 'External_network_size', 'Networking_outside_company'], return_type='plot', low_color='#4169E1', mid_color='#F1CC9E', high_color='#D8182A', textsize=10, plot_row_scaling_factor=0.8)[source]¶
Generate a summary heatmap or table scanning key Viva Insights metrics.
- Parameters:
data (pandas.DataFrame) – Person query data.
hrvar (str, optional) – Column name to group by. Defaults to
"Organization".mingroup (int, optional) – Minimum group size to include. Defaults to 5.
metrics (list of str, optional) – Metric column names to calculate averages for. Defaults to a standard set of Viva Insights metrics (see source).
return_type (str, optional) –
"plot"(default) returns a heatmap;"table"returns a summary DataFrame.low_color (str, optional) – Hex colour for low heatmap values. Defaults to
"#4169E1".mid_color (str, optional) – Hex colour for mid heatmap values. Defaults to
"#F1CC9E".high_color (str, optional) – Hex colour for high heatmap values. Defaults to
"#D8182A".textsize (int, optional) – Font size for heatmap annotations. Defaults to 10.
plot_row_scaling_factor (float, optional) – Scaling factor for plot row height. Defaults to 0.8.
- Returns:
Heatmap figure or summary table depending on
return_type.- Return type:
matplotlib.figure.Figure or pandas.DataFrame
- Raises:
ValueError – If no specified metrics exist in the data or if no groups remain after applying
mingroup.
Examples
>>> import vivainsights as vi >>> pq_data = vi.load_pq_data() >>> vi.keymetrics_scan(data=pq_data, hrvar="Organization", mingroup=10, return_type="table") >>> >>> vi.keymetrics_scan(data=pq_data, metrics=["Workweek_span", "Meeting_hours"], return_type="plot")