unalivepool
unalivepool7d ago

display output of all expressions in a single cell

Likely Issue Can't get marimo to display multiple dataframes in a single cell by default. Context: - By default, jupyter prints only the output of the last evaluated expression in a single cell. Working with multiple data frames, its tiresome to only look at a single frame in one cell. - Known work around for jupyter: if you run the following script in cell, it starts displaying output of all the expressions.
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
Details For the following sample code:
df1=pd.DataFrame([[1,2],[3,4]],columns=['col1','col2'])
df2=pd.DataFrame([[5,6],[7,8]],columns=['col3','col4'])
df1.sample(2)
df2.sample(2)
df1=pd.DataFrame([[1,2],[3,4]],columns=['col1','col2'])
df2=pd.DataFrame([[5,6],[7,8]],columns=['col3','col4'])
df1.sample(2)
df2.sample(2)
My expectation is that marimo renders 2 frames, one below another if I execute the same property update.. alternatively, I can achieve the same(render 2 dataframe in same cell) by using the output api.
mo.output.append(df1.sample(2))
mo.output.append(df2.sample(2))
mo.output.append(df1.sample(2))
mo.output.append(df2.sample(2))
I was wondering if there is a simpler way to do this for all expressions in a cell. Apologies if I am missing something obvious.
2 Replies
Myles Scolnick
We don’t have a way to automatically output all expressions. You current idea of mo.output.append is probably the best option today
unalivepool
unalivepoolOP6d ago
noted. thanks.