2

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
  • 34,372
  • 28
  • 129
  • 206
jeangelj
  • 3,878
  • 12
  • 45
  • 94

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
  • 729,927
  • 78
  • 1,141
  • 1,090
1

By using shape

df1.shape[0]+df2.shape[0]
BENY
  • 296,997
  • 19
  • 147
  • 204