Pandas Series of lists to one series

后端 未结 9 2157
野性不改
野性不改 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:37

    If your pandas version is too old to use series_name.explode(), this should work too:

    from itertools import chain
    
    pd.Series(
        chain.from_iterable(
            value
            for i, value
            in series_name.iteritems()
        )
    )
    

提交回复
热议问题