I am having problems trying to remove substrings from a column that are contained within the string of another column:
df = pd.DataFrame(
{
"substring": ["This", "sentence."],
"id": [1, 1],
"string": ["This is a sentence.", "This is another sentence."],
}
)
df["replaced"] = df["string"].str.replace(df["substring"], "")