Python Forum
Storing variables into one file for use in multiple Jupyter notebooks - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Storing variables into one file for use in multiple Jupyter notebooks (/thread-36285.html)



Storing variables into one file for use in multiple Jupyter notebooks - devansing - Feb-05-2022

Hi,

I'm working with a bunch of economic indicators (~50) using a couple of APIs and am trying to figure out the best way to compile them as variables and call them across various Jupyter notebook files from one spot, instead of having to repeat all of the code every time I need to access the data. I'm using Pandas to display the data as variables and then combining them into various charts. I'm hoping there's an efficient way to manage all of the variables in one file – either a notebook or CSV.

Here's an example of one of my variables:

employment = pd.DataFrame(quandl.get("FRED/PAYEMS", start_date = "1939-01-01", end_date = "2022-12-31"))
Thanks!


RE: Storing variables into one file for use in multiple Jupyter notebooks - ibreeden - Feb-05-2022

The most simple way would be to store those parameters in one file. And each of the programs should then use this file.
There are various ways to implement this principle. One could import a settings.py for example.
I would prefer to gather all settings in one dictionary and then save that as a Json file: settings.json.