3 ms·
You are absolutely right I have taken to referring to that as “notebook code.” I love jupyter because its a great interactive programming environment that spee
by faizshah 5y ago
You are absolutely right I have taken to referring to that as “notebook code.”
I love jupyter because its a great interactive programming environment that speeds up building scripts. But jupyter notebooks always end up being…notebooks. They are records of past work and thoughts that I had but I wouldn't present my paper notes to a coworker as finished documentation. I always end up extracting those jupyter snippets into runnable scripts and then I end up doing a lot of the work all over again as I parameterize things.
I have taken to using pycharm scientific mode and adding “cells” into my scripts: https://blog.jetbrains.com/pycharm/2018/04/pycharm-scientific-mode-with-code-cells/ https://blog.jetbrains.com/pycharm/2018/04/pycharm-scientifi...
You get the interactivity of jupyter with the cells, the scientific view for plots and data, but you’re also writing a real script so you can still maintain some sanity in your code and good git history (and hopefully add some tests).
Then I combine these scripts together into a makefile and voila quick, easy and maintainable scripts. If you just stick to make, python, pandas and bash any programmer can modify your pipeline without needing specialist skills. I have written scrapers + ETL in <1.5 hour (journalist needed some data quick) with this method.
God I wish I still worked in data science I’m currently a front end dev and don’t get to do any of this at work. It’s such fun and offers so much room for creativity and problem solving.
- wodenokoto 5y agoI think notebooks are great for building a presentation / reports of a data exploration, but I agree that they shouldn't represent programs. Rstudio won't export an R-markdown notebook to PDF without rerunning all cells sequentially. It's great for keeping the code "in check", but for things that takes hours to run, it can be quite annoying. I do think most of the problems with notebooks go away if you somehow force sequential running before presenting it to other people. Another really cool take on notebooks are Julia's Pluto Notebooks. Like a spreadsheet, there is no sequence that cells are run in. Everything is updated simultaneously. It's kinda hard to explain, but the JuliacCn presentation on these is absolutely wonderful: https://www.youtube.com/watch?v=IAF8DjrQSSk https://www.youtube.com/watch?v=IAF8DjrQSSk