3 ms·
How difficult is it to port pandas code to use polars instead? I use pandas a bunch, but sometimes it can be quite slow, especially with file I/O. Anybody hav
by oofbey 3y ago
How difficult is it to port pandas code to use polars instead? I use pandas a bunch, but sometimes it can be quite slow, especially with file I/O. Anybody have benchmarks?
- nojito 3y agothere are some here. https://duckdblabs.github.io/db-benchmark/ https://duckdblabs.github.io/db-benchmark/
- __mharrison__ 3y agoGenerally requires requiring the code. Sadly, AI is quite poor at Polars right now. (It is ok but not great with Pandas). However, getting pandas data into Polars is easy. If you already have the code and it is not a bottleneck, I would just wrap it. (Disclosure: currently writing a book on Polars and have a big chapter on porting hairy pandas code to Polars.)
- vundercind 3y agoMostly minor API differences. Methods with slightly different (usually better) names, sometimes slightly different behavior. Usually easy to wrap in a little function to handle the transition. Sometimes a property becomes a method. That kind of thing. A handful of nice-to-have utility things in Pandas aren’t in Polars. Some basic objects or datastructures are pretty different (print a dataframe’s dtypes property in both for an example)
- sk11001 3y agoBig disagree that it's minor - the polars API is completely different from pandas.