Have you ever need to calculate the percent of total for your data? I bet you’ve encountered situations like that many times. It’s a common analysis, that if you know how to do, would benefit you as a data professional. In this blog post, I’ll demonstrate how to do that in Polars. Here’s the link…
Month: May 2023

Conditional Logic or If-Else in Polars
One of the most common patterns in data is the need for conditional logic or if-else statements. You may want to assign a specific value when a certain condition is met. This is easily done in Pandas, using numpy.where() or pandas.where(). But how about Polars? The short answer is yes, you can do the same…

Write Better Code with Pipe in Polars
Have you encountered situations where you’re applying so many transformation on a Polars dataframe that your code is hard to follow? It’s a double edged sword where you can do a lot in Polars, but it could also create a mess. In this post, I’ll introduce a Polars functionality, pipe(), that helps make your code…

How to Add Custom Functionality in Polars
Polars being one of the best Python libraries to work with data, it’s still new and it lacks some functionalities you may find in pandas, for example. But did you know there is a way to add your own custom functionality/method to Polars without having to go through the process and complexity of contributing to…

How to Use SQL in Polars
Introduction There are a few ways you can use SQL in Polars. One option is to use other libraries such as DuckDB and pandas. And another option is to actually run SQL without using other libraries. I’ll be demonstrating the latter in this blog post. Please refer to this post on how to use DuckDB…

The Difference Between LASTNONBLANK and LASTNONBLANKVALUE in DAX
There are so many useful functions in DAX, however, there are also some functions that are not too intuitive to understand. I’ll cover such functions particularly LASTNONBLANK() and LASTNONBLANKVALUE() in the blog post. Note that the difference I explain in this blog post also applied to FIRSTNONBLANK() and FIRSTNONBLANKVALUE() I use Contoso dataset in DAX.do…

How To Create Views in BigQuery
In this post, I’ll introduce two easy ways to create views in BigQuery directly in Google Cloud console. Option 1 – Create and run your query. Then save it as view. 1. Create a query for your view & run the query 2. Just click save as view Option 2 – Use “Create View As”…