0

I have multiple times seen that applying e.g. pd.concat([df1, df2], axis=0) will yield a succesfully concatenated dataframe. However - when printing in the terminal to check the correctness, a row might randomly be missing. However - it is actually there when asking for it.

In short:

df1 = 10 rows and 3columns
df2 = 10 rows and 3 (same) columns
df = pd.concat([df1, df2], axis=0, ignore_index=True)

df may now print as a 19 row dataframe. WHY on earth? I can still find the missing row through slicing - then i will get a true/false indexation of length 20.

I simply do not understand the logic behind this, and there is not much online from what I see.

Hope someone has solved the mystery before..

JL_BB
  • 1
  • 2
    Please share both df1 and df2 considering they both have 10 rows. Also, `pd.concat` shouldn't hide any row even if there are duplicate indexes, rows etc. – Nuri Taş Aug 24 '22 at 18:37
  • 1
    Please share more of your code, including how you are counting the number of rows. As @NuriTaş implied, pd.concat is likely not the source of your problem. – Juancheeto Aug 24 '22 at 18:40
  • [How to make a minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example), [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391) – AlexK Aug 25 '22 at 00:49

0 Answers0