Mady
Mady2mo ago

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:
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...
No description
Jump to solution
4 Replies
Myles Scolnick
Myles Scolnick2mo ago
Could you link your notebook? Or is the code private?
Solution
Akshay
Akshay2mo ago
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
No description
Mady
MadyOP2mo ago
I believe you're right, I moved some code around and now it seems to be working. Thanks for the reminder about this!
Akshay
Akshay2mo ago
Yup np!