- display_with_styles(df, apply_styles_func)#
Display a Pandas dataframe as a table.
DataFrame styler objects only support HTML output. If the Jupyter Notebook output does not have HTML support, (it is a command line), then display DataFrame as is without styles.
For apply_style_func example see :py:method:`tradingstrategy.analysis.portfolioanalyzer.expand_timeline`.
df (DataFrame) – Pandas Dataframe we want to display as a table.
apply_styles_func (Callable) – A function to call on DataFrame to add its styles on it. We need to pass this as callable due to Pandas architectural limitations. The function will create styles using pandas.DataFrame.style object. However if styles are applied the resulting object can no longer be displayed in a terminal. Thus, we need to separate the procses of creating dataframe and creating styles and applying them.