Py学习  »  Python

Python-字符串拆分为+(加号)

TipsyHyena • 4 年前 • 495 次点击  

我有一些数据框:

df = pd.DataFrame({'columnA': ['pizza_+_pasta', 'pizza_-_pasta', 'apple_+_bacon']})

分裂 '_-_' 工作正常:

enter image description here

但又开始分裂 _+_ 不(!):

enter image description here

发生什么事?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50762
 
495 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Ke Zhu
Reply   •   1 楼
Ke Zhu    4 年前

需要逃跑+

df['columnA'].str.split(pat='_\+_', expand=True)