0

I want to create new column in DataFrame which contains following list but not in arranged format that is already in list, It should have to put value in new column randomly.

LIST : ['ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'ABC', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Ef', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z']

Here is the dataframe with 120 rows & i have list of 120 elements

Here is the dataframe with 120 rows & i have list of 120 elements

create new column with disarranged format of this exact values from list.

Dipam Soni
  • 71
  • 1
  • 8

1 Answers1

0
import random
l = [...]
random.shuffle(l)
df["Col_name"] = l

Hope this helps!

TheRavenSpectre
  • 367
  • 2
  • 11