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

I want to vertically merge two polars.LazyFrames in order to avoid collecting both LazyFrames beforehan

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   │
└─────┘

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744834890a4596202.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信