I have two datasets A and B. What I would like to do is for each observation in A, I would like to find 5 observations from B that are closest and match to A.
How should I start?
Thank you for your help!
Look at "unsupervised nearest neighbor" algorithm. This algorithm needs records to be first expressed as vectors so that "distance" between two point so that it makes sense to talk about distance between two points. For each point in data A, you can look for K nearest neighbors from data B, after expressing all observations in a common vector space.
You will have to handle categorical columns correctly (say using one-hot encoding), as there's no concept of (direct) distance between categorical data.
Python scikit-learn library has a good implementation of this algorithm. Reading the API documentation is a good place to start.