from numpy.core.defchararray import find
df = pd.DataFrame({
"string": ["abc", "def", "ghi"],
"substring": ["bc", "e", "ghi"]
})
I got following to determine the start position but I am not sure how to get the end position:
df.assign(start=find(df['string'].values.astype(str),df['substring'].values.astype(str)))
expected result:
string substring start end
abc bc 1 2
def e 1 1
ghi ghi 0 2