Issue
I have this dataframe:
d = pd.DataFrame({'test':['test?_Apple','test?_Banana', 'test?_limon']})
And I want to remove the test?_
string from test columns values to get this:
d = pd.DataFrame({'test':['Apple','Banana', 'limon']})
I am trying:
d['test'] = d['test'].str.extract(r'test?_(.*)')
but it returns NAN
Can someone help me on this one?
Solution
Escape ?
because special regex character:
d['test'] = d['test'].str.extract(r'test\?_(.*)')
Answered By - jezrael
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.