nps_group

nps_group(x, labels=False)

Classify Net Promoter Score answers into groups.

Collapses a 0-10 “how likely to recommend” question into the three standard NPS groups: detractors (0-6), passives (7-8) and promoters (9-10). The signed -1/0/1 coding is deliberate: its mean, times 100, is exactly the Net Promoter Score, which is how calc_nps() computes the headline number. Inputs are run through ensure_numeric() first, so worded answers like “9 - very likely” are classified correctly. Values outside 0-10 (and missing values) return missing.

Parameters

Name Type Description Default
x list or Series 0-10 ratings (text input is coerced). required
labels bool If False (default) returns the signed integer coding -1 / 0 / 1 used by calc_nps(). If True returns “Detractor” / “Passive” / “Promoter”. False

Returns

Name Type Description
pandas.Series Nullable integers (Int64) or text, the same length as x.

See Also

calc_nps, plot_nps

Examples

>>> nps_group([0, 6, 7, 8, 9, 10])
>>> nps_group([3, 8, 10], labels=True)