Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Created June 1, 2016 22:16
Show Gist options
  • Save RobSpectre/52efd76a4d33832b19789a514af11f79 to your computer and use it in GitHub Desktop.
Save RobSpectre/52efd76a4d33832b19789a514af11f79 to your computer and use it in GitHub Desktop.
Calculate Net Promoter Score with Python lambda function
nps = lambda x: float(((len([i for i in x if i > 8]) / len(x)) * 100) - ((len([i for i in x if i < 7]) / len(x)) * 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment