在Python的pandas库中,有一个由字符串值组成的Series/dataframe列需要合并为一个长字符串:
df = pd.DataFrame({'text' : pd.Series(['Hello', 'world', '!'], index=['a', 'b', 'c'])})
目标:'Hello world !'
到目前为止,像df['text'].apply(lambda x: ' '.join(x))
这样的方法只返回Series。
最好的方法是什么来获得连接后的字符串?