vivainsights.identify_inactiveweeks¶
Identify weeks where collaboration hours fall far below the mean.
The function identify_inactiveweeks identifies weeks where collaboration hours are more than a specified number of standard deviations below the mean and returns the result in the specified format.
- vivainsights.identify_inactiveweeks.identify_inactiveweeks(data, sd=2, return_type='text')[source]¶
Identify weeks where collaboration hours fall far below the mean.
Uses z-scores per person to flag weeks with abnormally low collaboration activity.
- Parameters:
data (pandas.DataFrame) – Person query data. Must contain
PersonIdandCollaboration_hours.sd (int, default 2) – Number of standard deviations below the mean to flag as inactive.
return_type (str, default "text") –
"text"for a diagnostic message,"data_dirty"/"dirty_data"for inactive rows only,"data_cleaned"/"cleaned_data"for active rows only, or"data"for the full dataset with aninactiveweekflag.
- Returns:
A diagnostic message or a filtered / labelled DataFrame depending on return_type.
- Return type:
str or pandas.DataFrame
Examples
Return a diagnostic text summary:
>>> import vivainsights as vi >>> pq_data = vi.load_pq_data() >>> vi.identify_inactiveweeks(pq_data, sd=2, return_type="text")
Return the full dataset with inactive weeks flagged:
>>> vi.identify_inactiveweeks(pq_data, sd=2, return_type="data")
Return only the cleaned dataset (inactive weeks removed):
>>> vi.identify_inactiveweeks(pq_data, sd=2, return_type="data_cleaned")
Return only the dirty rows (inactive weeks):
>>> vi.identify_inactiveweeks(pq_data, sd=2, return_type="data_dirty")