pandas: How do I split text in a column into multiple rows?

后端 未结 7 1289
说谎
说谎 2020-11-22 09:47

I\'m working with a large csv file and the next to last column has a string of text that I want to split by a specific delimiter. I was wondering if there is a simple way to

7条回答
  •  不要未来只要你来
    2020-11-22 10:05

    Another approach would be like this:

    temp = df['Seatblocks'].str.split(' ')
    data = data.reindex(data.index.repeat(temp.apply(len)))
    data['new_Seatblocks'] = np.hstack(temp)
    

提交回复
热议问题