4

I have two DataFrames df1 and df2.

I want to see what the length of both is added up.

But it seems I can't do len(df1) + len(df2).

Is there a quick way to do this (without joining them)?

Brad Solomon
  • 38,521
  • 31
  • 149
  • 235
jeangelj
  • 4,338
  • 16
  • 54
  • 98

2 Answers2

2

I think the fastest is sum lengths of indexes:

len(df1.index) + len(df2.index)

But is is same like your solution:

len(df1) + len(df2)
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
1

By using shape

df1.shape[0]+df2.shape[0]
BENY
  • 317,841
  • 20
  • 164
  • 234