Hello. I want to merge the following datasets by str and hnr:
As you can see, Dataset 1 has the actual hnr-value of the person. Dataset 2 has a range of hnr, that assigns to a specific code. But it is possible, that the hnr-ranges overlap so I can not cleary assign a code for every case. I dont want to merge this cases and just mark them in Dataset 1 as "no unique code". The other obs in Dataset 1 shall be merged with their clear code.
Thanks for your help!
Dataset 1 | |||
str | hnr | ||
alphastreet | 2 | ||
alphastreet | 7 | ||
alphastreet | 12 | ||
betastreet | 1 | ||
Dataset 2 | |||
str | hnr_min | hnr_max | code |
alphastreet | 1 | 8 | 1111 |
alphastreet | 5 | 8 | 2222 |
alphastreet | 6 | 8 | 2222 |
alphastreet | 9 | 12 | 3333 |
betastreet | 1 | 5 | 4444 |
Thanks for your help!
Comment