使用正则表达式时,我得到:
import re
string = r'http://www.example.com/abc.html'
result = re.search('^.*com', string).group()
在熊猫中,我写道:
df = pd.DataFrame(columns = ['index', 'url'])
df.loc[len(df), :] = [1, 'http://www.example.com/abc.html']
df.loc[len(df), :] = [2, 'http://www.hello.com/def.html']
df.str.extract('^.*com')
ValueError: pattern contains no capture groups
如何解决问题?
相关分类