Published on: 5th September 2022
This post was created while writing my Data Analysis with Polars course. Check it out on Udemy
There’s a tension between having clear verbose code and code that’s quick and easy to type.
Verbose code is great for production, but when doing rapid data exploration in ipython or jupyter you really want something quick.
To address this you can use setattr to set up an alias for your function. In my case I use value_counts() a lot, so I alias the function with vc. This means it goes from 12 characters to 2.
It’s also good to drop the underscore - these double press chars put a lot more stress on your fingers when repeated!
H/T Ritchie Vink for sharing this method with me.
Follow me if you’re interested in learning more about high performance data processing in python!
Want to know more about Polars for high performance data science? Then you can:
or let me know if you would like a Polars workshop for your organisation.