Skip to content

Instantly share code, notes, and snippets.

@CharlyWargnier
Last active February 8, 2020 18:38
Show Gist options
  • Select an option

  • Save CharlyWargnier/010a521d322accd6f3557dee39b56393 to your computer and use it in GitHub Desktop.

Select an option

Save CharlyWargnier/010a521d322accd6f3557dee39b56393 to your computer and use it in GitHub Desktop.
df['SEBotClass'] = pd.np.where(df.userAgent.str.contains("YandexBot"), "YandexBot",
pd.np.where(df.userAgent.str.contains("bingbot"), "BingBot",
pd.np.where(df.userAgent.str.contains("DuckDuckBot"), "DuckDuckGo",
pd.np.where(df.userAgent.str.contains("Baiduspider"), "Baidu",
pd.np.where(df.userAgent.str.contains("Googlebot/2.1"), "GoogleBot", "Else")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment