Python Pandas concatenate a Series of strings into one string

前端 未结 2 628
悲&欢浪女
悲&欢浪女 2020-12-02 02:04

In python pandas, there is a Series/dataframe column of str values to combine into one long string:

df = pd.DataFrame({\'text\' : pd.Series([\'Hello\', \'wor         


        
2条回答
  •  醉酒成梦
    2020-12-02 02:29

    You can join a string on the series directly:

    In [3]:
    ' '.join(df['text'])
    
    Out[3]:
    'Hello world !'
    

提交回复
热议问题