I have an example dataframe:
col1 col2
0 Hello, is it me you're looking for Hello
1 Hello, is it me you're looking for me
2 Hello, is it me you're looking for looking
3 Hello, is it me you're looking for for
4 Hello, is it me you're looking for Lionel
5 Hello, is it me you're looking for Richie
I would like to change col1 so that it removed the string in col2, and return the ammended dataframe. I would also like to remove the characters 1 before and 1 after the string, for example, the desired output for index 1 would be:
col 1 col 2
1 Hello, is ityou're looking for me
I have tried using pd.apply(), pd.map() with a .replace() function, but I can't get the .replace() to use pd.['col2'] as an argument. I also feel as if it isn't the best way to go about it.
Any help? I'm mostly new to pandas and am looking to learn, so please ELI5.
Thanks!