[英]Python Performance concern - Multiple methods reading same Pandas Data Frame from a particular Pickle file
We have multiple (4) methods reading the same Pandas Data Frame from a particular / the same - Pickle file stored on the local directory. 我们有多个(4)方法从特定/相同的文件中读取相同的Pandas数据框 - 存储在本地目录中的Pickle文件。 Code creating the only pickle file as below :- 代码创建唯一的pickle文件如下: -
df_for_bokeh = pd.read_sql(sql_command,engine)
df_for_bokeh.to_pickle("./df_holoviewPlots.pkl")
Code snippets from the methods reading the pickle file as below :- 读取pickle文件的方法的代码片段如下: -
df_for_bokeh = pd.read_pickle("./df_holoviewPlots.pkl")
df_for_bokeh1 = pd.read_pickle("./df_holoviewPlots.pkl")
df_for_bokeh2 = pd.read_pickle("./df_holoviewPlots.pkl")
df_for_bokeh3 = pd.read_pickle("./df_holoviewPlots.pkl")
As seen above My concern with performance is - would this be better or should we pickle the DF into 4 separate in place of the same Pickle file. 如上所述,我对性能的关注是 - 这会更好还是应该将DF腌制成4个单独的Pickle文件。
We can not have the pickle file - unpickled to give only 1 DataFrame . 我们不能有pickle文件 - unpickled只提供1个DataFrame。 We shall need atleast - 4 different data frames to be read from the one Pickle file , and that too almost at the same time. 我们需要至少 - 从一个Pickle文件中读取4个不同的数据帧,而且几乎同时也是如此。
Is there a reason you can't do the following: 有没有理由你不能做到以下几点:
This would give you the same data in 4 different independent data frames. 这将在4个不同的独立数据帧中提供相同的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.