vivainsights.identify_nkw

Identify non-knowledge workers based on collaboration activity thresholds.

vivainsights.identify_nkw.identify_nkw(data, collab_threshold=5, return_type='data_summary')[source]

Identify non-knowledge workers based on collaboration activity.

Groups the data by PersonId and Organization, computes mean collaboration hours, and flags employees below the threshold as non-knowledge workers.

Parameters:
  • data (pandas.DataFrame) – Person query data. Must contain PersonId, Organization, and Collaboration_hours.

  • collab_threshold (int, default 5) – Average weekly collaboration hours below which a person is considered a non-knowledge worker.

  • return_type (str, default "data_summary") – "data_with_flag" adds a flag_nkw column, "data_summary" returns per-organization counts, "text" returns a diagnostic message, "data_clean" / "data_cleaned" returns only knowledge workers.

Returns:

Depending on return_type.

Return type:

pandas.DataFrame or str

Examples

Return a text summary of non-knowledge workers:

>>> import vivainsights as vi
>>> pq_data = vi.load_pq_data()
>>> vi.identify_nkw(pq_data, collab_threshold=15, return_type="text")

Return a flagged dataset with flag_nkw column:

>>> vi.identify_nkw(pq_data, collab_threshold=15, return_type="data_with_flag")

Return a summary table of NKW counts by organization:

>>> vi.identify_nkw(pq_data, collab_threshold=15, return_type="data_summary")

Return only the cleaned data (non-knowledge workers removed):

>>> vi.identify_nkw(pq_data, collab_threshold=15, return_type="data_clean")