想要将每一列中包含句子的一列数据帧转换为字符串

问题描述 投票:0回答:1

这是我只在此处发布数据框的一部分

dataframe = ['想关闭我的卡','想停用emi 44卡','想停用55我的bajaj emi卡','想停用55我的emi卡','想停止我的卡77 bajaj finserv卡”,“取消我的emi卡的过程是什么”]

所以我如何将所有这些转换为字符串值

pandas
1个回答
0
投票

尝试一下,

df=pd.DataFrame({'col':  ['want to close my card', 'want to deactivate emi 44 card', 'want to deactivate 55 my bajaj emi card', 'want to deactivate 55 my emi card', 'want to discontinue my 77 bajaj finserv card', 'what is the process to cancel my emi card']})
print(' '.join(df.col.values.tolist()))

O / P:

'want to close my card want to deactivate emi 44 card want to deactivate 55 my bajaj emi card want to deactivate 55 my emi card want to discontinue my 77 bajaj finserv card what is the process to cancel my emi card'
© www.soinside.com 2019 - 2024. All rights reserved.