So, the situation is:
I have two numpy 2d arrays/pandas dataframes (doesn't matter, what I will use).Each of them contains approximately 106 records.Each record is a row with 10 float numbers.
I need to replace each row in second array(dataframe) with row from the first table, which has the smallest MSE compared to it. I can easily do it with "for" loops, but it sounds horrifyingly slow. Is there nice and beautiful numpy/pandas solution I don't see?
P.S For example:
arr1: [[1,2,3],[4,5,6],[7,8,9]]
arr2:[[9,10,11],[3,2,1],[5,5,5]]
result should be:[[7,8,9],[1,2,3],[4,5,6]]
in this example there are 3 numbers in each record and 3 records total. I have 10 numbers in each record, and around 1000000 records total