首页 > 解决方案 > Apache Beam 到 Pandas 数据框

问题描述

亲爱的 Beam 用户社区,我是 Apache Beam 的新手,但想利用 Beam 进行快速文件处理。现在我正在努力将 Beam 对象转换为数据框。所以我使用 convert_to_dataframe 将管道转换为延迟数据帧。我想知道是否有办法将其进一步转换为数据帧,以便我可以使用诸如 head 等 Pandas 代码操作数据帧。如果我使用 Pandas.head、pandas.regex 等方法,则会收到此错误: 

apache_beam.dataframe.frame_base.WontImplementError: 'head' is not yet supported because it is `order-sensitive <https://s.apache.org/dataframe-order-sensitive-operations>`_.

If you want to peek at a large dataset consider using interactive Beam's :func:`ib.collect <apache_beam.runners.interactive.interactive_beam.collect>` with ``n`` specified, or :meth:`sample`. If you want to find the N largest elements, consider using :meth:`DeferredDataFrame.nlargest`.

我想知道我是否应该使用 ib.collect 如果是的话,我应该注意什么额外的限制?太感谢了!

标签: pandasapache-beam

解决方案


推荐阅读