Add len of two DataFrames

Viewed 179

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)?

2 Answers

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)

By using shape

df1.shape[0]+df2.shape[0]
Related