0

I have three datasets of different shapes. I want to merge them horizontally. How to do that.

Three dfs are following

data_Xception = pd.concat([data_Covid,data_Normal,data_Pneumonia],axis = 1)

I want output as

enter image description here

How to do it?

I tried data = pd.concat([data_Covid,data_Normal,data_Pneumonia],axis = 1) enter image description here

The format is okay but I have total 1288 values

data_Covid:- 116 data_Normal:- 317 data_Pneumonia:- 855

I am getting 855 records. How to get full 1288 values

XYZ
  • 225
  • 1
  • 12
  • Your expected output seems a vertical concatenation as well, but you may try removing `axis=1` from `pd.concat`. – Nuri Taş Sep 23 '22 at 16:14
  • I think this thread answers your question: [Pandas combine dataframes horizontally based on index value](https://stackoverflow.com/questions/67271943/pandas-combine-dataframes-horizontally-based-on-index-value) – Vilkamini Sep 23 '22 at 16:20
  • @NuriTaş didnot work – XYZ Sep 23 '22 at 16:43
  • @Vilkamini, I tried the same way, but this is not what I am looking for – XYZ Sep 23 '22 at 16:45
  • So you also want them to merge vertically? I don't understand what you're trying to do, your output now contains all records, just next to each other – T C Molenaar Sep 23 '22 at 17:55
  • 1
    https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question/285557#285557 – BERA Sep 24 '22 at 07:52

0 Answers0