如何使用pyarrow将Pandas数据帧设置/获取到Redis中

发布于 2021-01-29 15:26:55

使用

dd = {'ID': ['H576','H577','H578','H600', 'H700'],
      'CD': ['AAAAAAA', 'BBBBB', 'CCCCCC','DDDDDD', 'EEEEEEE']}
df = pd.DataFrame(dd)

在Pandas 0.25之前,这在下面起作用。

set:  redisConn.set("key", df.to_msgpack(compress='zlib'))
get:  pd.read_msgpack(redisConn.get("key"))

现在,已弃用警告。

FutureWarning: to_msgpack is deprecated and will be removed in a future version.
It is recommended to use pyarrow for on-the-wire transmission of pandas objects.

The read_msgpack is deprecated and will be removed in a future version.
It is recommended to use pyarrow for on-the-wire transmission of pandas objects.

骨髓如何运作?而且,我如何使pyarrow对象进出Redis。

参考:
如何在Redis中设置pandas.DataFrame或从Redis获取pandas.DataFrame?

关注者
0
被浏览
145
1 个回答
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看