我有一个包含多列的数据帧df1
。我需要用大写字母分隔此列中的每个字符串;看起来很容易,但(对我来说(并非如此。
我已经尝试了str.split
和regex
但不起作用
df1['Edition Statement]=df1['Edition Statement'].str.split('A', expand=True)
df1
希望用大写字母分隔字符串
试试这个:
df1['Edition Statement'].str.split('[A-Z]', expand=True)
[A-Z] 是一个大写字母的正则表达式。