notebooks
notebooks copied to clipboard
Move function definitions to a module
I recommend moving definitions of functions from the notebooks into a module (which can be a simple python script file). This will provide the following benefits:
- Make the notebooks more clean and readable, as they will mostly contain plots made by calls to functions defined separately.
- Make easier to track changes to the function definitions, since it will be in standard python script file(s), rather than embedded inside a notebook. This in turn will facilitate contributions from users that don't know or use Jupyter notebooks.
I mostly use Jupyter notebooks with R, but I use this approach constantly and it works great. I think a good start would be to move all the cells with def statements and module imports into separate functions.py file, which can then be loaded at the top of the notebook.
Yes, I agree. We'd welcome a PR if anyone wants to take this on
I can try later, if nobody else will step up...