在Python中,如果有一个变量numbers = 5,然后像编写numbers = 55那样在下一个变量中更新变量的值。
在使用Pluto.jl时,我声明了一个名为y_axis的变量。我决定在另一个单元格中更改这个变量的值,但是我得到了以下错误:
Multiple definitions for y_axis.
Combine all definitions into a single reactive cell using a `begin ... end` block.为什么Pluto.jl不让我改变一个变量?让我给你看看我在说什么。这是第一个牢房:
begin
countries_data_labels = ["Italy", "Germany", "Pakistan", "Turkey", "United Kingdom"];
y_axis = DataFrame() # Creating an empty dataframe to populate the y-axis when plotting graphs.
...
end下面是两个细胞:
begin
...
y_axis = select!(y_axis, Not([:One_million]));
end我相信冥王星允许改变一个变量,而不必创建一个巨大的细胞块,但我不知道怎么做。
发布于 2021-03-21 19:18:08
冥王星常见问题中包括了这一点:
如何修改不同单元格中的变量?变量只能在单个单元格中赋值和修改。这使得反应性成为可能。
https://github.com/fonsp/Pluto.jl/wiki/%E2%9A%A1-Writing-and-running-code
如果您已经习惯了与python不同的工作流,可以考虑通过IJulia使用jupyter笔记本。
https://stackoverflow.com/questions/66736246
复制相似问题