admin管理员组

文章数量:1406306

Let say I have two notebooks:

  • nba.ipynb
  • nbb.ipynb

In notebook A, I try to run: %run -n nbB.ipynb so that the two notebooks are running in two different namespace. However, after execute %run -n nbB.ipynb, it still overwrite on my x, y variable

Sample code: nba.ipynb

x = 2

y = 100
%store y

%run -n nbb.ipynb
%store -r y   # it still update y regardless having this or not

nbb.ipynb

x=3

%store -r y
y += 50

How to fix this?

本文标签: pythonhow to execute notebook in different namespaceStack Overflow