How can i disarrange this list to add into new DatFrame column


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

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

>Solution :

import random
l = [...]
df["Col_name"] = l

Hope this helps!

Leave a Reply Cancel reply