最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dataframe - Is there a way to vertically merge two polars.LazyFrames in Python? - Stack Overflow

programmeradmin3浏览0评论

I want to vertically merge two polars.LazyFrames in order to avoid collecting both LazyFrames beforehand, which is computationally expensive. I have tried extend(), concat(), and vstack() but none of them are implemented for LazyFrames. Maybe I am missing the point about LazyFrames by trying to perform this operation, but I am aware that join() works, which would also alter the dataframe's structure.

I want to vertically merge two polars.LazyFrames in order to avoid collecting both LazyFrames beforehand, which is computationally expensive. I have tried extend(), concat(), and vstack() but none of them are implemented for LazyFrames. Maybe I am missing the point about LazyFrames by trying to perform this operation, but I am aware that join() works, which would also alter the dataframe's structure.

Share Improve this question edited Mar 10 at 17:14 cafce25 28k5 gold badges45 silver badges58 bronze badges asked Mar 10 at 16:28 realbitsurferrealbitsurfer 767 bronze badges 1
  • My bad, I did not read the error message of my concat() attempt close enough. Thank you for the answer! – realbitsurfer Commented Mar 12 at 16:41
Add a comment  | 

1 Answer 1

Reset to default 8

pl.concat can be used with LazyFrames:

>>> lf = pl.LazyFrame({"x": [1, 2]})
>>> pl.concat([lf, lf]).collect()
shape: (4, 1)
┌─────┐
│ x   │
│ --- │
│ i64 │
╞═════╡
│ 1   │
│ 2   │
│ 1   │
│ 2   │
└─────┘
发布评论

评论列表(0)

  1. 暂无评论