OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Match index of two dataframes:

  • Thread starter Thread starter Ruby
  • Start date Start date
R

Ruby

Guest
I have a dataframes like | X | Y | | -------- | -------------- | |0|1| |0|125| |1|65| |1|59| |2|28| and so on and another datframe like

| index | lat | lon | |:---- |:------:| -----:| |0|90.0|0.0| |1|90.0|12.5| |2|90.0|25.0| |3|90.0|37.5| |4|90.0|50.0| I want to match the first df1['X'] column with the second df2['index'] and update the first dataframe. My output should look like

| X | lat | lon | Y| |:---- |:------:| -----:|-----:| |0|90.0|0.0|1| |0|90.0|0.0|125| |1|90.0|12.5|65| |1|90.0|12.5|59| |2|90.0|25.0|28| |..|..|..| and so on. The two dataframes have different lengths. Any lead?
<p>I have a dataframes like
| X | Y |
| -------- | -------------- |
|0|1|
|0|125|
|1|65|
|1|59|
|2|28|
and so on and another datframe like</p>
<p>| index | lat | lon |
|:---- |:------:| -----:|
|0|90.0|0.0|
|1|90.0|12.5|
|2|90.0|25.0|
|3|90.0|37.5|
|4|90.0|50.0|
I want to match the first df1['X'] column with the second df2['index'] and update the first dataframe. My output should look like</p>
<p>| X | lat | lon | Y|
|:---- |:------:| -----:|-----:|
|0|90.0|0.0|1|
|0|90.0|0.0|125|
|1|90.0|12.5|65|
|1|90.0|12.5|59|
|2|90.0|25.0|28|
|..|..|..|
and so on. The two dataframes have different lengths. Any lead?</p>
 

Latest posts

B
Replies
0
Views
1
Blundering Ecologist
B
Top