You can use pd.merge
function with how='outer'
as parameter to combine multiple dataframes with different number of rows into a single dataframe.
Here is an example code that shows how to do it:
main.py359 chars13 lines
This will result in the following output:
main.py80 chars11 lines
Note that how='outer'
will include all the rows from all dataframes, even if there is no match in the other dataframes. If you only want to include the rows that match in all dataframes, you can use how='inner'
instead.
gistlibby LogSnag