Home

executioncount

Executioncount, usually referred to as execution_count in official documentation, is a field used by IPython and Jupyter notebooks to record the execution order of code cells. It is part of the notebook file format (.ipynb) and is associated with each code cell. The value is an integer representing the global execution step when the cell was last run, or null if the cell has not yet been executed.

In the notebook interface, a code cell displays a prompt such as In [n]:, where n corresponds

Semantically, execution_count is primarily a labeling mechanism rather than a computational feature. It helps users understand

Not all environments expose execution_count, and it is specific to code cells within IPython/Jupyter notebooks. It

to
the
cell’s
last
execution
count.
Corresponding
outputs
are
labeled
with
Out
[n],
linking
the
result
to
the
same
execution
event.
The
count
increases
with
every
execution
of
a
code
cell,
reflecting
the
order
in
which
code
was
executed
across
the
notebook.
Rerunning
cells
updates
the
relevant
execution_count
values
to
the
new
global
step.
the
sequence
of
results,
reproduce
experiments,
and
assess
the
relative
freshness
of
outputs.
The
count
is
stored
in
the
notebook’s
JSON
representation,
alongside
the
cell’s
source
code
and
outputs.
If
a
kernel
is
restarted,
the
execution_count
values
may
no
longer
reflect
the
newest
state
until
cells
are
re-executed.
does
not
affect
the
execution
of
code
itself;
it
serves
as
a
bookkeeping
aid
for
users
reviewing
and
sharing
interactive
sessions.
See
also:
IPython,
Jupyter
Notebook,
notebook
file
format,
In
[n]
and
Out
[n]
prompts.