Skip to content

Instantly share code, notes, and snippets.

@seangtkelley
Created June 26, 2018 20:03
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 seangtkelley/3d5d302f9d46993a957b09aa9744a840 to your computer and use it in GitHub Desktop.
Save seangtkelley/3d5d302f9d46993a957b09aa9744a840 to your computer and use it in GitHub Desktop.
census_surnames = pd.read_csv('app_c.csv')
census_firstnames = pd.read_csv('census-derived-all-first.csv')
firsts_lower = [str(name).lower() for name in list(census_firstnames.name)]
lasts_lower = [str(name).lower() for name in list(census_surnames.name)]
d = gender.Detector()
male_titles = []
female_titles = []
for i in tqdm(range(6647)):
try:
firstname = playlist[i].title.split()[0].lower()
lastname = playlist[i].title.split()[1].lower()
video_title = ' '.join(playlist[i].title.split()[2:])
video_title = video_title.replace(" - CONAN on TBS", "")
video_title = video_title.replace("Conan", "")
# print(video_title)
if firstname in firsts_lower and lastname in lasts_lower and "/" not in video_title:
# print(firstname, d.get_gender(firstname.capitalize()))
if 'female' in d.get_gender(firstname.capitalize()):
female_titles.append(video_title)
elif 'male' in d.get_gender(firstname.capitalize()):
male_titles.append(video_title)
except Exception:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment