i wrote a function to remove an image link from text data (strings stored in pandas)
image_link_1 = 'â\x80¦IMAGEâ\x80¦'
image_link_2 = 'IMAGE'
def remove_image(text):
remove_im = ''.join([i for i in text if i not in image_link_1 and image_link_2])
return remove_im
df['title_and_abstract'] = df['title_and_abstract'].apply(lambda x: remove_image(x))
The problem is , that the function removes the first letter of some string. Espcially it seems that the function removes capital letter only. Weird.
Here´s an example
'This is an example string. Here is the IMAGE.'
after the function is used:
'his is an example string. Here is the .'
I realy dont get why this function does that.
Thank you in advance!