Answers for "dataframe python diplay 2 tables on same line"

0

dataframe python diplay 2 tables on same line

from IPython.core.display import display, HTML

def display_side_by_side(dfs:list, captions:list):
    """Display tables side by side to save vertical space
    Input:
        dfs: list of pandas.DataFrame
        captions: list of table captions
    """
    output = ""
    combined = dict(zip(captions, dfs))
    for caption, df in combined.items():
        output += df.style.set_table_attributes("style='display:inline'").set_caption(caption)._repr_html_()
        output += "xa0xa0xa0"
    display(HTML(output))
Posted by: Guest on February-04-2022

Code answers related to "dataframe python diplay 2 tables on same line"

Python Answers by Framework

Browse Popular Code Answers by Language