I have a column sites
in pandas df. Data format: list of strings. I need to change the values of the column to randomly generated words. My data below:
row sites
1 ["Elle", "Harpers", "Cosmo"]
2 ["Elle", "Vogue"]
3 ["Cosmo"]
Desired output:
row sites
1 ["KLD", "GHL", "JGF"]
2 ["KLD", "VGO"]
3 ["JGF"]
I should be able to reverse the names after also or have them saved in the format VGO = Vogue
I wanted to use numpy.random.randint
but seems like this method is only for integers. What is the fastest way to generate the names rather than hardcode using replace
?
Aucun commentaire:
Enregistrer un commentaire