问题
分隔左边第一个为空格,右边第一个为(的字符串
错误信息
AttributeError: 'list' object has no attribute 'rsplit'
代码
import pandas as pd
df= pd.Series(['void select(abcdefg)'])
df= df.str.split("(")[0].rsplit(" ")[-1]
df
运行结果及详细报错内容
AttributeError Traceback (most recent call last)
c:\Users\Localadmin\Desktop\Dev\test.ipynb Cell 1 in <cell line: 3>()
1 import pandas as pd
2 df= pd.Series(['void select(abcdefg)'])
----> 3 df= df.str.split("(")[0].rsplit(" ")[-1]
4 df
AttributeError: 'list' object has no attribute 'rsplit'
我想要达到的结果
void select(abcdefg)
分隔左边第一个为空格,右边第一个为(的字符串,也就是结果为:select