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
  png-file in Jupyter bunnkvarken 0 1,326 Oct-22-2024, 02:47 PM
Last Post: bunnkvarken
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 18,688 Oct-29-2023, 12:40 PM
Last Post: Mark17
  File path by adding various variables Mishal0488 2 6,359 Apr-28-2023, 07:17 PM
Last Post: deanhystad
  Joining two jupyter notebooks and getting an error! Led_Zeppelin 1 2,554 Oct-20-2022, 04:28 PM
Last Post: deanhystad
  python run multiple file paralaly mg24 2 1,877 Oct-11-2022, 06:08 PM
Last Post: deanhystad
  Delete multiple lines from txt file Lky 6 5,241 Jul-10-2022, 12:09 PM
Last Post: jefsummers
  How can I assign "multiple variables" to a single "value"? Psycpus 2 3,120 Oct-04-2021, 03:29 AM
Last Post: deanhystad
  Storing whole functions in variables dedesssse 3 3,684 Jul-29-2021, 09:17 PM
Last Post: deanhystad
  Deleting multiple variables/arrays Robotguy 0 2,881 Aug-18-2020, 09:56 PM
Last Post: Robotguy
  print function help percentage and slash (multiple variables) leodavinci1990 3 4,743 Aug-10-2020, 02:51 AM
Last Post: bowlofred

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.