I have a dataframe each row is a list like this:
word_count id token
0 6 0 [customer, executive]
1 6 0 [purchase]
2 6 0 [purchase, agent]
3 6 0 [housekeeping]
4 6 0 [night, auditor, &, guest, reception, agent]
I wanna convert the list to string like this:
word_count id token
0 6 0 customer executive
1 6 0 purchase
2 6 0 purchase agent
3 6 0 housekeeping
4 6 0 night auditor & guest reception agent
I did the following method but when I see de.head() nothing change:
for index, row in de.iterrows():
row['token']=' '.join(str(e) for e in row['token'])
de.head()
and
for index, row in de.iterrows():
row['token']=' '.join(row['token'])
de.head()
and
for index, row in de.iterrows():
row['token']=' '.join(row['token']).replace(',' ,' ')
de.head()
question from:
https://stackoverflow.com/questions/65850200/how-to-make-data-frames-list-rows-to-string 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…