I can't believe how long I've been trying to figure out this really basic problem, and I can't seem to find the right answer here searching through the forum, so I'll just throw it out, as I'm sure this can be solved in a simple line of code:
I'm trying to generate some a generate a new column on my data frame with random unique identifiers of the form q
+ some 5 digit number. So for example, one such ID would be q12345
.
My approach so far, as been to: (1) generate an array of numbers, and (2) a list of the same length of the q
character, and then (3) try to combine them into a single array, which I would (4) add to my data frame. I've managed to do steps one and two quite easily, but I can't seem to get step 3 to work.
I'd be grateful for any tips on both (a) how to do step 3, as well as (b) an easier way to do this, which I'm sure I'm overlooking.
I tried the various approaches in Concatenate string and int in python 3.4 and could get it to work for individual elements, but not for the entire array.
So, far, I have:
sample_length = 10 #for example
values = np.random.randint(low=10000, high= 15000, size = sample_length)
q = ['q'] * sample_length