Accessing data from another python notebook

Viewed 36

I know that you can run notebook A from notebook B by calling %run notebookA.ipynb and therefore, in notebook B, have access to a data frame that is in created in notebook A.

I also know that in the first notebook, you can do %store data and then in the second one you can do %store -r data and you have access to the data frame. But where is the data "stored"? Is it in __pycache__? I'm really confused about how this works, and whether it will work if I share the files with other people.

I have done some data processing in one notebook and I'd just like to be able to consistently access the data frame produced in that notebook, from another notebook. Is just running notebook A from notebook B the best option besides exporting the data after processing and accessing it directly? Any help is appreciated!

1 Answers

I think the best option is to save data into a file and load it in another notebook. If you don't want to save the dataframe into CSV or excel because you don't want to ruin the data when you read it again, you can save and load it using pickle or joblib

Related