Python 选择括号中的数据

Python 选择括号中的数据,python,pandas,slice,parentheses,Python,Pandas,Slice,Parentheses,我有一个csv文件中的电影列表,100行x 1列,如下所示: 1. Mulholland Drive (David Lynch, 2001) 我试图去掉前面的数字,把标题、导演和年份放在每一列。我做到了: rank = pd.read_csv("/Users/...csv", header = 0) rank.columns = ['1'] rank['1'] = rank['1'].str[3:] 为了去掉前面的所有数字,接下来,我想通过以下方式将括号中的数字分开: rank = ran

我有一个csv文件中的电影列表,100行x 1列,如下所示:

1. Mulholland Drive (David Lynch, 2001)
我试图去掉前面的数字,把标题、导演和年份放在每一列。我做到了:

rank = pd.read_csv("/Users/...csv", header = 0) 
rank.columns = ['1']
rank['1'] = rank['1'].str[3:]
为了去掉前面的所有数字,接下来,我想通过以下方式将括号中的数字分开:

rank = rank[rank.find("(")+1:rank.find(")")]
但我得到:

AttributeError: 'DataFrame' object has no attribute 'find'

例如,如果它们总是采用这种格式,则仅用给定的示例模拟一个文件(如果您有与格式不匹配的方括号或逗号等,则不是这样-这将中断):

这将给你:

                   0            1     2
0  Mulholland Drive   David Lynch  2001

可以更新您的全部代码吗?您可以展示一个预期注册的示例,以指导我们找到解决方案吗?您应该检查下面的正则表达式捕获方法,然后再进一步,在正则表达式中嵌入列名
regex=r'(?:\d+\.\s+(?P.*?)\s+(?P.*?)(?P\d+)”
然后
rank.film.str.extract(regex,expand=True)
@piRSquared好主意:)
                   0            1     2
0  Mulholland Drive   David Lynch  2001