Skip to content

Instantly share code, notes, and snippets.

View zehanort's full-sized avatar

Sotiris Niarchos zehanort

  • Utrecht University
  • Utrecht, Netherlands
View GitHub Profile
@zehanort
zehanort / reset_ipynb_exec_cnt.py
Last active July 19, 2020 19:21
Ever wanted to reset the execution counts of the cells of a jupyter notebook to make it more presentable (or to hide experiments and tweaks from your teachers or colleagues) but re-running everything was not an option (too long, too risky, the numbers happened to be toooooo good)? Well, now you have a way!
import argparse
import json
parser = argparse.ArgumentParser(
description='Reset the execution count of the code cells of a jupyter notebook'
)
parser.add_argument('notebook', help='the input jupyter notebook')
parser.add_argument('-i', '--inplace',
help='change the notebook file inplace', action='store_true')