0

I have 2 different excel files, each one contains different data, one of them has the next columns:

No. | Name | Xvalue | Yvalue |

And the other has the columns:

No. | Average | highestvalue | lowerValue

I want to merge this data based on the value of the number or the name, in the first excel i can have data from No. 1 to No. 50 but in the second i can have only data for No. 5, 9, 10, 20,

I want to merge my list to fit this data with the first file correspondig to the same value of No. or the same name.

How can i do that? I've tried this:

pd.merge(excel1, excel2)

But it doesn't fit my data

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
  • 1
    Perhaps it would help to go through [some basics.](https://stackoverflow.com/questions/53645882/pandas-merging-101) – cs95 Feb 08 '19 at 23:09
  • Also, I think it my prove useful to add some sample data, with expected output. – johnnyb Feb 09 '19 at 03:20

2 Answers2

0

I am not sure how your data is structured however, it seems you want certain attributes form excel2 in excel1.. This will merge on the column specified.

excel1.merge(excel2, left_on='No.')
leon
  • 13
  • 1
  • 6
0

Please try this instead:

pd.merge(excel1, excel2, how='outer')
Terry Ji
  • 1
  • 2