I would like to join (or merge) 2 dataframes where the index of the second dataframe is a substring of the one of the first dataframe. I could do it by creating a temporary column that is a substring of the index and then join on this column, but I'm sure there's another more intelligent way to do it.
df1:
XX0001S1 4
XX0001S2 4.5
XX0001S3 4
XX0253S1 13
XX0254S3 5
df2
XX0001 good
XX0253 bad
XX0254 average
result should be:
XX0001S1 4 good
XX0001S2 4.5 good
XX0001S3 4 good
XX0253S1 13 bad
XX0254S3 5 average
Any ideas please?
M.