
pandas vs Polars DataFrames? 👨🏻🍳 #python
Here's Marco Gorelli's take on why lazy execution matters So with pandas, everything happens eagerly. You give the library some instructions, and it evaluates your instructions the moment you give them. With Polars, there's an option to give it some instructions, it can wait a bit, and then do them all together in the most optimal way that it can detect. If I was to tell you to cook me a recipe ...and I gave you the steps one at a time ...and for each step, you have to go out and buy the ingredients that you need for that step ^ This is going to be a pretty inefficient way of making a cake But if I can give you the recipe beforehand: ...you can buy all the ingredients together ...you can maybe do 2 steps at the same time ^ This is going to be a much nicer cooking experience
image: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
With Pandas, everything happens eagerly. You give the library some instructions, and it evaluates your instructions the moment you give them. Whereas Polars, it's got an option whereby you can give it some instructions, it can wait a bit, and then it can do them all together in the most optimal way that it can detect. If I was to tell you to cook me a recipe, and I gave you the steps one at a time, and you had to do the steps one at a time, and for each step go out and buy the ingredients that you need for that step, it's going to be a pretty inefficient way of making a cake. But if I can give you the recipe beforehand, and you can buy all the ingredients together, then maybe do two steps at the same time, you know, it's going to be a much nicer cooking experience.
it's going to be a pretty inefficient way of making a cake. But if I can give you the recipe beforehand, and you can buy all the ingredients together, then maybe do two steps at the same time, you know, it's going to be a much nicer cooking experience.
