需要:

1. anconda环境

2. excel文件,有拆分标准的单元格内容(比如我此次的:**, ***, ****,...)

以前尝试自己写公式,唉,不是写不出来,就是太折腾了

3. 2行code,超级cool

# 拆分

new_data = df['关键字'].str.split(',', expand=True).stack().reset_index(level=1, drop=True).rename('new_column_name')

new_data.shape

# 合并

result = df.drop('关键字',axis=1).join(new_data)

# 输出

result.to_excel("拆分后.xlsx", index=False)

精彩链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: