I have this dataset;
text num
test one 3.5 and 60 test tow 3.5/60
test one 3/4 test tow 3/4
test one 5.0 test 10 tow 5.0
I need to remove the number from text column if it match in num so I have did this:
df['text']=[re.sub('{}'.format(number), '', the_text) for the_text, number in zip(df['text'], df['num'])]
the result become like
text num
test one 3.5 and 60 test tow 3.5/60
test one test tow 3/4
test one test 10 tow 5.0
as you can see the matched number was removed except the first row because it is not an exact match. so I want to use contains function match or anything similar to match part of a text.
I expect the first row will become
test one and test tow
I have did this but get error:
[re.sub(r"\b{}\b".format(word), "", the_text) for the_text, word in zip(df['text'], word='/'.join([r'{}'.format(words) for words in df['num']]) )]
TypeError: zip() takes no keyword arguments
any help?