I'm working with two DataFrames,
df1
altitude
132 16.324794
133 16.027025
134 15.738367
135 15.462613
136 15.195307
137 14.934009
138 14.682448
139 14.440509
140 14.207593
141 14.070644
df2
altitude density east_wind north_wind
0 5 0.020567 39.714397 6.795392
1 7 0.016871 41.171996 6.852655
2 9 0.013839 42.629594 6.909918
3 11 0.011351 44.087193 6.967182
4 13 0.009311 45.544791 7.024445
5 15 0.007638 47.003028 7.079618
6 17 0.006263 48.303168 7.340789
7 19 0.005129 48.942837 8.478684
8 21 0.004201 49.588021 9.587021
9 23 0.003433 50.797853 11.256209
I'd like to map the altitude in df1 to the closest altitude in df2 and eventually merging the density east_wind and north_wind values of that row to a new Dataframe.
Expected Result
altitude density east_wind north_wind
132 16.324794 0.006263 48.303168 7.340789
136 15.195307 0.007638 47.003028 7.079618
137 14.934009 0.007638 47.003028 7.079618
Please Advise
132is the index value,16.324794is thealtitudeand it is mapped to17