have a df
a b
mark 50
john 60
jack 30
harry 80
jacob 10
Need to make a new column in df with some random values
Create 2d random array of letters and join them in list comprehension:
L = list('abcdefghijklmnopqrstuvwxyz')
df['c'] = ['test'+ ''.join(x) for x in np.random.choice(L, size=(len(df), 3))]
print (df)
a b c
0 mark 50 testpje
1 john 60 testrmn
2 jack 30 testoud
3 harry 80 testasw
4 jacob 10 testagx