Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

In python how to share a large data structure across modules (no copies)

$
0
0

I am working on a prject where I use a Pandas dataframe, rather large, and I need to let several functions access it.So far I have used a single python script, where I create the dataframe as global to the script, and then define the various functions, which read and write from/to it.So far, so good.

Now, the project is growing, and so is the number of functions, and I would like to split the project into several files (modules).

The first idea is to let the dataframe to be global across the modules, and I have found some info on how to do it (I would still appreciate a comment on which is the best/most pythonic/most efficient way).However, I have rad that this is frown upon.

So, what would be the best approach, taking into account that the dataframe can become quite large, so that making a copy local to each function, when called, would be inefficient?

Thanks!


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>