Pandas Series of lists to one series

后端 未结 9 2191
野性不改
野性不改 2020-12-28 13:18

I have a Pandas Series of lists of strings:

0                           [slim, waist, man]
1                                [slim, waistline]
2                       


        
9条回答
  •  感情败类
    2020-12-28 13:46

    You may also try:

    combined = []
    for i in s.index:
        combined = combined + s.iloc[i]
    
    print(combined)
    
    s = pd.Series(combined)
    print(s)
    

    output:

    ['slim', 'waist', 'man', 'slim', 'waistline', 'santa']
    
    0         slim
    1        waist
    2          man
    3         slim
    4    waistline
    5        santa
    
    dtype: object
    

提交回复
热议问题