How to render two pd.DataFrames in jupyter notebook side by side?

dataframe, ipython, jupyter, pandas

Solution

The closest to what you want could be:

> df1.merge(df2, right_index=1, left_index=1, suffixes=("_1", "_2"))
   a_1  b_1  a_2  b_2
0    1    2  1.1  2.1
1    3    4  3.1  4.1

It's not specific of the notebook, but it will work, and it's not that complicated. Another solution would be to convert your dataframe to an image and put them side by side in subplots. But it's a bit far-fetched and complicated.

Problem

Is there an easy way to quickly see contents of two pd.DataFrames side-by-side in Jupyter notebooks? ``` df1 = pd.DataFrame([(1,2),(3,4)], columns=['a', 'b']) df2 = pd.DataFrame([(1.1,2.1),(3.1,4.1)], columns=['a', 'b']) df1, df2 ```

Original source