I have a DataFrame that looks like this:
Full Partial
ABCDEFGHIJKLMNOPQRSTUVWXYZ FGHIJKL
ANLHDFKNADHFBAKHFGBAKJFB FKNADH
JABFKADFNADKHFBADHBFJDHFBADF ABFKA
What I want to do is to put everything from Full that does NOT match Partial in lowercase, yielding the following:
Coverage
abcdef_GHIJKL_mnopqrstuvwxyz
anlhd_FKNADH_fbakhfgbakjfb
j_ABFKA_dfnadkhfbadhbfjdhfbadf
How would I do this? I looked around and it seems that series.str.extract() could be a solution, but I'm not certain as when I try to do this:
df['Full'].str.extract(data['Partial'])
... it only says that Series can't be hashable. I assume that extract only takes a single argument, rather than a Series? Is there any way to bypass this? Is extract even the correct way to achieve what I'm looking for, or is there another way? I'm thinking I could perhaps find som way to extract the string indexes and do the following pseudocode:
df['Coverage'] = data['Full'][:start].lower() + '_' + data['Partial'] + \
'_' + data['Full'][End:].lower()
... where Start and End is the indexes for where data['Partial'] starts and ends, respectively. Thoughts?