Get help from the marimo community

Updated 2 months ago

difference in execution between publicly shared project link and editor

At a glance

The community member is editing a dataframe to replace null values with "unknown" before rendering it in a Plotly chart. The issue is that when the notebook is shared, the cell rendering the chart runs before the cell that replaces the values. Another community member suggests that the cells may not be ordered correctly, and that the dataframe should be edited in the same cell where it is defined or reassigned to a new variable in each cell that it is edited. The original community member believes this is the issue and has moved some code around, which seems to have resolved the problem.

Useful resources
I am editing a dataframe to replace null values with "unknown" prior to rendering it in a chart with Plotly. When the notebook runs in the online editor, it works as expected. However, if I share the link to the notebook with the project publish button, it seems that the cell rendering the chart somehow runs before the cell that replaces the values.
M
A
M
4 comments
Could you link your notebook? Or is the code private?
It sounds like the cells that are running out-of-order may not actually be ordered.

marimo can't track mutations, so if you are editing a dataframe, you need to either edit it in the same cell in which it's defined, or reassign the dataframe to a new variable in each cell that it is edited.

If this is actually the problem, there is an explanation here: https://docs.marimo.io/guides/reactivity.html#avoid-mutating-variables
Attachment
image.png
I believe you're right, I moved some code around and now it seems to be working. Thanks for the reminder about this!
Add a reply
Sign up and join the conversation on Discord