Skip to content

Instantly share code, notes, and snippets.

@a-agmon
Last active January 15, 2020 05:05
Show Gist options
  • Save a-agmon/e5d76c9fc24f0eb05c5d8734ef156769 to your computer and use it in GitHub Desktop.
Save a-agmon/e5d76c9fc24f0eb05c5d8734ef156769 to your computer and use it in GitHub Desktop.
first_letters = 'ABCDEF'
second_numbers = '120'
last_letters = 'QWOPZXML'
# returns a string of the following format: [4 letters A-F][1 digit 0-2][3 letters QWOPZXML]
def get_random_string():
str1 = ''.join(random.choice(first_letters) for i in range(4))
str2 = random.choice(second_numbers)
str3 = ''.join(random.choice(last_letters) for i in range(3))
return str1+str2+str3
# get 25,000 sequences of this format
random_sequences = [get_random_string() for i in range(25000)]
#this will return string according to the following format
# ['CBCA2QOM', 'FBEF0WZW', 'DBFB2ZML', 'BFCB2WXO']
# add some anomalies to our list
random_sequences.extend(['XYDC2DCA', 'TXSX1ABC','RNIU4XRE','AABDXUEI','SDRAC5RF'])
#save this to a dataframe
seqs_ds = pd.DataFrame(random_sequences)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment