I’m trying to remove rows that contain string based on the string value. To do, I’m looking for specific substring within the strings. My issue comes from the fact that those substrings contain spaces and that is seems my current filter does not take the space into consideration.
# List of substring to remove
searchfor = ['Value ', 'VALUE ', 'Value.', 'VALUE.']
# keeping only the rows with the substrings
df[df["""column"""].str.contains('|'.join(searchfor))]
Yet, I still retrieve some rows containing values such as:
“XXVALUEXXXXXX”
I believe the space should have remove those but apparently not.