pythonpandasdataframejupyterpandas-styles

Display pandas dataframe with larger font in jupyter notebook


I have a small-shaped (5 rows, 3 columns) dataframe which I can display by calling df in jupyter cell. I would like to enlarge (font size) this output for presentation purpose. Is it possible?


Solution

  • You can play around with styles using df.style.set_table_styles()

    This might help:

    heading_properties = [('font-size', '18px')]
    
    cell_properties = [('font-size', '16px')]
    
    dfstyle = [dict(selector="th", props=heading_properties),\
     dict(selector="td", props=cell_properties)]
    
    df.style.set_table_styles(dfstyle)