3 ms·
Read_csv - yes. I just tried loading a 5MM row csv. Pandas took 5.5 secs. Polars took 0.6 secs. .apply - might be faster in Polars but will not be as fast as u
by wenc 4y ago
Read_csv - yes. I just tried loading a 5MM row csv. Pandas took 5.5 secs. Polars took 0.6 secs.
.apply - might be faster in Polars but will not be as fast as using native expressions. That’s because applying a Python function invokes the GIL which kills parallelization and this is an inherent limitation of Python.
That said, I try not to use Python functions these days. I write transformations in SQL (or native expressions in Polars) and these can be executed at full speed with complete vectorization and parallelization.
- dr_kiszonka 4y agoThanks, wenc - I will give loading csvs with polars a try! Moving to SQL sounds like a good idea. I just don't have the time to convert my codebase and configure everything correctly.
- hn2017 4y agowould things like "to_sql" be faster in Polars too?