Skip to content

Instantly share code, notes, and snippets.

@CharlyWargnier
Created February 8, 2020 17:29
Show Gist options
  • Select an option

  • Save CharlyWargnier/5040f287406af2370d2c598f4d310fc0 to your computer and use it in GitHub Desktop.

Select an option

Save CharlyWargnier/5040f287406af2370d2c598f4d310fc0 to your computer and use it in GitHub Desktop.
df['httpCodeClass'] = pd.np.where(df.httpCode.str.contains("^1.*"), 'Info (1XX)',
pd.np.where(df.httpCode.str.contains("^2.*"), 'Success (2XX)',
pd.np.where(df.httpCode.str.contains("^3.*"), 'Redirects (3XX)',
pd.np.where(df.httpCode.str.contains("^4.*"), 'Client errors (4XX)', 'Server errors (5XX)'))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment