6
$\begingroup$

I'm trying to make a GUI in PyQt5 to present the results of my research. The results are around 800 pandas dataframes, stored in lists (so that I can call them individually according to the list index).

In this GUI, I want to have Radiobuttons to tell the program which list to use, and an Input to tell the program which one of the dataframes in the corresponding list to show. Now, I have made a crude algorithm (without a GUI) to do this, and it works, however the lists and, thus, the dataframes, are stored as variables in the original Jupyter notebook, which is full of the convoluted and inelegant code I used to process and store these results. I managed to save them using %store, and was able to use them in a new Jupyter notebook, but for the GUI I will need to use a separate Python script file. My problem is that this command doesn't work when I try to use it in the script file, to restore and use the variables there.

tldr: Is there a proper way to store lists of dataframes, exactly as they are (I don't want the indexing to be messed up), so that I can call them/import them in a separate Python script, and use them in the GUI?

P.S.: As you can understand, I'm new to Python, so I'm sorry if my programming methods seem inelegant and my question trivial.

$\endgroup$
1
  • $\begingroup$ Use feather format $\endgroup$
    – Aditya
    Jan 13, 2020 at 18:13

1 Answer 1

2
$\begingroup$

Use pickle package, it's meant to export and/or load python objects.

You can find information of how is done in this topic of stack overflow: https://stackoverflow.com/questions/4529815/saving-an-object-data-persistence

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.