Yesterday I published a post about how to create a module in jupyter. There is another way to quickly import the code from another notebook. Say you are working in your_notebook.ipynb and you need a Python class class Hello(): from another_notebook.ipynb. To import it you just need to do the following: # in your_notebook.ipynb do %run another_notebook.ipynb hello = Hello() Voila, with %run you access the code from the other notebook.
In my current attempt to improve the development experience of my team, I am trying to introduce Jupyter notebooks to share knowledge about some data analysis scripts developed over the last years. I can copy paste the code into a notebook, run the single cells to show the result below the code, export the notebook as markdown and push it to Bitbucket: voila, documentation. Though, a disadvantage of Jupyter notebooks over Python scripts is that they cannot be linked to each other.
I have been asked to extract data from Elasticsearch and I had no clue of what kind of data were stored inside of it. Moreover, there was a lack of documentation and the only thing that could help me were some old Python scripts written by an old colleague. Fortunately, Python is pretty damn good when it comes to readability. So, because I am working to improve the development experience of my team and I am messing around with Jupyter, I thought I could create a Jupyter notebook with a super simple Elasticsearch client in Python 3 that supports a connection with a proxy (vital, if working in a company).