How can I loop through an entire dataframe to remove data in cells that contain a particular string when the column names are unknown?
Here’s what I have so far:
for (i in colnames(df)){
df2 = df[~df[i].str.contains('found')]
My data:
Getting links from: https://www.bar.com/ Getting links from: https://www.boo.com/ Getting links from: https://www.foo.com/
0 ├───OK─── http://www.this.com/ ├───OK─── http://www.this.com/ ├───OK─── http://www.this.com/
1 ├───OK─── http://www.is.com/ ├───OK─── http://www.is.com/ ├───OK─── http://www.is.com/
2 ├─BROKEN─ http://www.broken.com/ 2 links found. 0 excluded. 0 broken. ├─BROKEN─ http://www.broken.com/
3 NaN NaN ├───OK─── http://www.set.com/
4 NaN NaN ├───OK─── http://www.one.com/
How can I delete the entire contents of a cell if it contains a string, for instance, 'found'? I want to delete everything in the cell (including before and after the string.)