difference in execution between publicly shared project link and editor
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.
Solution:Jump to solution
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...
4 Replies
Could you link your notebook? Or is the code private?
Solution
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
I believe you're right, I moved some code around and now it seems to be working. Thanks for the reminder about this!
Yup np!