Created
August 19, 2020 09:32
-
-
Save sid321axn/49a513c1bd39429ea2fd2bc26c210910 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
from tld import get_tld | |
import os.path | |
#Length of Top Level Domain | |
df['tld'] = df['url'].apply(lambda i: get_tld(i,fail_silently=True)) | |
def tld_length(tld): | |
try: | |
return len(tld) | |
except: | |
return -1 | |
df['tld_length'] = df['tld'].apply(lambda i: tld_length(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment