Skip to content

Instantly share code, notes, and snippets.

@sid321axn
Created August 19, 2020 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sid321axn/afb8829919a4df497f3155ac922cfac2 to your computer and use it in GitHub Desktop.
Save sid321axn/afb8829919a4df497f3155ac922cfac2 to your computer and use it in GitHub Desktop.
def abnormal_url(url):
hostname = urlparse(url).hostname
hostname = str(hostname)
match = re.search(hostname, url)
if match:
# print match.group()
return 1
else:
# print 'No matching pattern found'
return 0
df['abnormal_url'] = df['url'].apply(lambda i: abnormal_url(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment