Created
August 19, 2020 12:44
-
-
Save sid321axn/afb8829919a4df497f3155ac922cfac2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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