添加两个DataFrame的len

时间:2017-10-03 14:31:35

标签: python pandas dataframe count addition

我有两个DataFrame df1df2

我想知道两者的长度是多少。

但似乎我无法len(df1) + len(df2)

有没有快速的方法(没有加入)?

2 个答案:

答案 0 :(得分:1)

我认为最快的是总和lengths of indexes

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

但是和你的解决方案一样:

len(df1) + len(df2)

答案 1 :(得分:1)

使用shape

df1.shape[0]+df2.shape[0]
相关问题