• Blog
  • Book
Categories
All (35)
100DaysOfPolars (17)
data analysis (2)
visualization (2)
 

Filtering for multiple items in polars

is_in
Sometimes, you may want to filter data for more than one item. Polars makes this type of filtering straightforward. Below is a dataframe showing streaming services and their…
2025-07-14

Joram Mutenge

 

Group by calculations in polars

group_by
Aggregations to data professionals are what a saw is to a carpenter. Almost every data analysis you perform will involve an aggregate calculation, or group_by calculations…
2025-07-12

Joram Mutenge

 

Adding values across multiple columns in polars

sum_horizontal
Most dataframe libraries are excellent at performing columnar operations, such as adding or multiplying values within a single column. However, there are times when you may…
2025-07-11

Joram Mutenge

 

How to sample data with polars

sample
Analyzing a very large dataset can be strenuous on your computer, especially if you don’t have a fast machine. Instead of overworking your computer and waiting a long time…
2025-07-10

Joram Mutenge

 

Stacking dataframes vertically in polars

vstack
Combining two dataframes into a single dataframe is a common operation in data analysis. Dataframes can be combined vertically (one on top of the other) or horizontally…
2025-07-09

Joram Mutenge

Adding conditional formatting to excel workbooks with polars

write_excel
Polars allows you to save data in multiple file formats like CSV, Parquet, Avro—even Excel. What most people don’t know is that you can add special formatting to the Excel…
2025-07-07

Joram Mutenge

 

Creating a datetime column from multiple columns in polars

pl.date
When you have a column with date values, having its data type as datetime is beneficial because it allows you to perform time series analysis on your data. You can slice the…
2025-07-06

Joram Mutenge

 

Keyboard time is the key to learning how to code

Most people say they want to learn how to code, but if you take a look at how they spend their time acquiring that skill, it makes you question whether they will ever become…
2025-07-04

Joram Mutenge

 

How to convert from pandas to polars dataframe

pl.from_pandas
Polars is highly versatile. It can accept a Pandas dataframe and convert it into a Polars dataframe. This conversion is especially useful when working with HTML data, as…
2025-07-03

Joram Mutenge

 

Maintaining a column name without retyping it in polars

name.keep
DataFrames make it easy to create new columns and rename existing ones. That’s why I prefer doing data analysis with DataFrames rather than SQL tables. Say we have a…
2025-07-02

Joram Mutenge

 

Joining text data with polars

pl.concat_str
Most people have a love-hate relationship with text data, but if you work in the data field, you’re bound to encounter it.
2025-07-01

Joram Mutenge

 

Getting every other row of the dataframe with polars

gather_every
There comes a time when you want to extract every other row from your DataFrame. What I mean is: get the first row, skip the second, get the third, skip the fourth, and so on.
2025-06-30

Joram Mutenge

 

How to know the number of days in each month with polars

dt.month_end
If I asked you, “How many days are in each month of the calendar?” most people would be able to answer for a few months, but not all.
2025-06-29

Joram Mutenge

Why aren’t more data people talking about ibis?

If you started working in the data field 20 years ago, you probably used a lot of SQL. It’s a robust, 50-year-old technology that excels at querying data, thanks to decades…
2025-06-25

Joram Mutenge

 

Converting unix timestamp to polars datetime

pl.from_epoch
Computers are good at recording timestamps, but they do it in Unix time. Sadly, humans aren’t great at interpreting Unix time.
2025-06-24

Joram Mutenge

 

Adding a currency symbol to polars dataframe values

pl.format
When your dataframe contains monetary values such as budgets it’s helpful to include a currency symbol. This ensures your audience clearly understands whether the figures…
2025-06-23

Joram Mutenge

 

Turning a polars dataframe to long format with explode

explode
Tabular data is easier to process when columns contain singular values of the same data type for each row. However, sometimes data can be stored as a list in a single row.
2025-06-20

Joram Mutenge

 

Arranging columns in a specific order using index in polars

pl.nth
Stacking dataframes vertically only works when the column names are the same and arranged in the same order. For example, if you have df1 with columns Name and Age, and df2 w…
2025-06-19

Joram Mutenge

 

How to remove whitespace in column values using polars in python

strip_chars
In data science or data analysis, counting unique values is very common. However, having whitespace (empty space at the beginning or at the end) in your values can lead to…
2025-06-18

Joram Mutenge

 

Your beautiful code doesn’t matter anymore (and that’s fine)

Your code doesn’t run in a vacuum. Your tools, your projects, your career all depend on a fast-moving ecosystem of languages, libraries, platforms, datasets, and now, AI.
2025-06-12

Joram Mutenge

 

Most data analysts are stuck using mediocre tools thanks to the familiarity trap

Data analysts aren’t exactly known for their technical wizardry – at least not if “technical” means writing actual code that doesn’t make software engineers weep. In fact…
2025-06-01

Joram Mutenge

 

Idea person or Thoughtful person: Which one are you?

If you’re working in an organization, you can’t escape meetings. They are part and parcel of day-to-day life in any workplace. But sometimes, it can feel like all you ever…
2025-05-25

Joram Mutenge

 

The single most important lesson I learned from my retired boss

The day my boss retired, a small part of me died.
2025-05-18

Joram Mutenge

 

Let me be the new host of The Data Scientist Show

I messaged Daliana Liu, host of The Data Scientist Show, on LinkedIn asking to become the new host. If you know her, please share this post so she sees it.
2025-04-26

Joram Mutenge

I made my first pull request to the Marimo team

If you work extensively with data in Python, you’ll agree that Jupyter notebooks provide an excellent environment for data analysis. I’ve used Jupyter notebooks for a long…
2025-03-03

Joram Mutenge

How to improve a bad graph with plotly

All data visualizations should, first and foremost, inform. Any visualization that falls short of this is simply data art. Data visualizations that are uninformative may be…
2025-02-25

Joram Mutenge

Creating a desktop app using kivy in python

I love watching movies and TV shows, but there are just too many out there that it’s often difficult to pick what to watch. For years, I’ve been updating my database of…
2025-02-22

Joram Mutenge

Using set theory to speed up your data analysis

Most data analysis tasks involve joining tables to get more data or filter out specific data. But what happens when the data you’re working with isn’t in a format that…
2025-02-09

Joram Mutenge

 

How overlooking a small detail on a job interview can disqualify you for a position

A month ago, I interviewed a candidate for a junior data analyst position. Given how difficult it is to land an interview in the data field due to stiff competition, I…
2025-02-01

Joram Mutenge

Ten polars functions that pros use and amateurs don’t

Polars is increasingly becoming a popular data analysis library, and my prediction is that more new data scientists and analysts will be starting with Polars rather than…
2025-01-13

Joram Mutenge

Tranforming timeseries data with group by and group by dynamic in polars

Polars has become my go-to library for data analysis. Each client project brings new insights into the powerful functionality Polars offers. Recently, I worked on a project…
2025-01-06

Joram Mutenge

 

What I learned about group by dynamic in polars while working on a client’s project

In the last client project I worked on, I learned something about the group_by_dynamic function in Polars. While what I learned was surprising, the fact that I learned it…
2024-12-30

Joram Mutenge

How to create charts from The Economist magazine using plotly

We at Conterval have always been fans of the charts from The Economist magazine. No publication does a better job of creating static visualizations you can use in print. We…
2024-12-15

Joram Mutenge

What tool should you use as a data analyst?

Data analysis is a hot field nowadays. Companies are opening up new data analyst positions, and many people want to become data analysts.
2024-12-01

Joram Mutenge

How we helped a bakery generate forecast by bread type using polars

A few weeks ago, Conterval did a consulting gig for a medium-sized bakery. This bakery makes white and brown bread, which it sells to a major retail store here in the USA.…
2024-11-18

Joram Mutenge

No matching items
     

    © 2025 Conterval · Contact