ipython line number out of order creates NameError -


i have ipython notebook running in browser, , have nameerror 'x', in it's defined above in notebook, has numerically lower line number, believe reason nameerror.

for example, looks this:

in [12]: x = np.random.random((3, 4)) in [4]: print x  --------------------------------------------------------------------------- nameerror                                 traceback (most recent call last) <ipython-input-2-73c1d467e5a9> in <module>()       1 #your code here ----> 2 print x  nameerror: name 'x' not defined 

how fix execution order here?

the number of left indicates order of execution of block of codes.

depending on how run each cell number changes. in example, need run [12] [4] change [13]. , x print.

the order you. however, on top bar can click on run all, run blocks top-down.

to avoid confusion , variables defined. suggest regularly restart ipython kernel (top bar also) , run all.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -