user16017809
user16017809

Reputation:

Get max length dataframe from multiple dataframes

ex :

df1
id A B C
1  2 2 2
2  3 3 3

df2
id A B C
1  5 5 5
2  6 6 6
3  8 8 8
4  0 0 0

df3 
id A B C
1  6 6 6

len(df1) is 2
len(df2) is 4
len(df3) is 1

Here the maximum length dataframe is df2, So How to find maximum length dataframe from multiple dataframes I want to build logic(function), it should return the biggest df from the same Thank you

Upvotes: 1

Views: 420

Answers (1)

Guy
Guy

Reputation: 50899

You can use max with len as key

df = max(df1, df2, df3, key=len)

Upvotes: 3

Related Questions