Python Forum
Storing variables into one file for use in multiple Jupyter notebooks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing variables into one file for use in multiple Jupyter notebooks
#1
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!
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 720 Oct-29-2023, 12:40 PM
Last Post: Mark17
  File path by adding various variables Mishal0488 2 1,046 Apr-28-2023, 07:17 PM
Last Post: deanhystad
  Joining two jupyter notebooks and getting an error! Led_Zeppelin 1 1,145 Oct-20-2022, 04:28 PM
Last Post: deanhystad
  How can I assign "multiple variables" to a single "value"? Psycpus 2 1,866 Oct-04-2021, 03:29 AM
Last Post: deanhystad
  Storing whole functions in variables dedesssse 3 2,102 Jul-29-2021, 09:17 PM
Last Post: deanhystad
  Deleting multiple variables/arrays Robotguy 0 1,507 Aug-18-2020, 09:56 PM
Last Post: Robotguy
  print function help percentage and slash (multiple variables) leodavinci1990 3 2,499 Aug-10-2020, 02:51 AM
Last Post: bowlofred
  Help Setting Multiple Variables bzowk 0 1,611 Jul-18-2020, 06:59 PM
Last Post: bzowk
  Issues with storing variables outside of a function cerulean747 7 3,735 Apr-30-2020, 08:46 AM
Last Post: DeaD_EyE
  Importing variables from another file IILawrenceII 7 10,046 Jan-18-2020, 12:31 PM
Last Post: IILawrenceII

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020