Panel Dataframe Max Rows pd.set_option('display.max_rows', 5)

It would be nice if panel dataframes respected pd.set_option('display.max_rows', 5) or had a similar global settings interface like pn.set_option(‘display.max_rows’, 5). Because in my parameterized classes, now instead of just being able to return dataframes in my functions, I have to return pn.panel(df, max_rows=5), which is annoying because sometimes I just want the raw dataframe.

import pandas as pd
import panel as pn
pd.set_option('display.max_rows', 5)

df = pd.DataFrame(list(range(20)))



pn.panel(df, max_rows=5)

I’m pretty sure we just call df.to_html() behind the scenes.

As a side note, I was trying to figure out how to limit rows for a pandas styled dataframe and got help in this thread: ENH: Enhance printing options for stylized DataFrames · Issue #42533 · pandas-dev/pandas · GitHub

import pandas as pd
import panel as pn
pd.set_option('styler.render.max_rows', 5) # styler.render.max_rows
# See

df = pd.DataFrame(list(range(20)))

# Define CSS style for the sapphire color on column 'A' header
styles = [
    {'selector': 'th.col_heading.level0.col0', 
     'props': [('background-color', 'blue'), ('color', 'white')]}

# Apply the style to the DataFrame
styled_df =, overwrite=False)