Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Created August 28, 2021 17:45
Show Gist options
  • Select an option

  • Save marcosan93/bf3206c75197ff94ade3a0ee170bebbd to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/bf3206c75197ff94ade3a0ee170bebbd to your computer and use it in GitHub Desktop.
def makeBio(subscriber):
"""
Making a short or long bio depending their subscription status.
"""
if subscriber==True:
# Randomizing bio length but skewed towards longer bios
bio_len = random.choices([10,20], weights=(10,90), k=1)[0]
elif subscriber==False:
# Randomizing bio length but skewed towards shorter bios
bio_len = random.choices([1,3], weights=(10,90), k=1)[0]
return faker.sentence(bio_len)
df['bio'] = [makeBio(i) for i in df['subscriber']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment