Python

Quick Tip: Image Analysis With Python

Let’s say, we’re working for a retailer. They have two distribution centres in Australia – the geographic area covered by each distribution centre is coloured in orange. Our task is to, from this image, work out to how many square kilometers of Australia can we deliver and what percentage of the country is that? Right, […]

Read more
Python

Bamboolib: The Most Flexible Pandas GUI?

As data engineers and data scientists, we’re spend a lot of time exploring data. When you’re working with huge datasets, you may find you need to utilise Apache Spark or similar to conduct this exploratative analysis but for the majority of use-cases, Pandas is the defaqto tool we choose. The Pandas library has been so […]

Read more
Python

Another Pandas GUI: Pandas Profiling

Another GUI for Pandas! YES – they’re coming out of the woodwork now! But this one is a little bit different to the Pandas GUI library I discussed previously. Pandas GUI let us slice and dise our data; restructure it and visualize it. Pandas Profiling isn’t as feature-rich but provides a different way of looking […]

Read more
Python

A GUI For Pandas! Is This A Game Changer?

Pandas is the defaqto library for data analysis in Python for good reason. It’s infinitely flexible, relatively performant and easy to learn. That said, quite a lot of what we, as data scientists and engineers do is trial and error and exploration. This exploratative process can sometimes be a bit tedius. We create a dataframe; […]

Read more
Python

Calculating Distance Between Two Geo Points In Python

As you may be aware, I am a Python tutor online and quite often I get asked pretty specific questions. This week, I was asked to show a simple way to find the distance in kilometres between two geographic locations. So, here it is then – the easiest way to approach this problem is to […]

Read more
Python

A UK Postcode Validation Script In Python

The below script takes the input of a UK postcode and ensures that it matches a valid format. I have handled the below formats: X11XX XX11XX XX111XX To do this, I use some regular expressions. Let’s look at one: “^[a-zA-Z]{1}[0-9]{2}[a-zA-Z]{2}”. Here: The beginning of the string (denoted with a ^) needs to be a letter. […]

Read more
Python

Making a simple hangman game in Python

Today I thought it might be cool to make a super simple little text based game in Python in my spare 15 minutes. So I made this hangman game. As you can see, the word chosen is ‘squiggle’. As the user selects new letters, all occurences of those letters are uncovered in the list. If […]

Read more
Python

Python Brainteaser: Formatting Numbers with Commas

Often, you will want to format your numbers in Python because it’s quite hard for a user to read 10000000000 and immediately understand it as: 10,000,000,000. So, this little article will show you one possible way to do the formatting – using many of the Python concepts discussed in previous articles and in my Udemy […]

Read more
Python

Introducing Zip Lists in Python

The Python zip function is incredibly useful. It takes in an iterable (a list, a tuple, a dictionary etc..) and returns an iterator. Well, that’s as clear as mud, right? Let’s look at an example to clear things up. Let’s imagine I have three lists like below. These lists are related to one another. Index […]

Read more
Python

Quick Tip: Lambda Functions

Those of you that know me will know I am not a fan of Lambda functions. I just don’t buy into the notion of making code as concise as possible at the detriment of readability. To show you what I mean, I have written two functions. One is a Lambda function and the other is […]

Read more
Python

Quick Tip: Filter function in Python

This is a really quick post about filtering in Python. In the below, you will see that we have a list of animals. I want to filter that list based on a boolean condition – the name of the animal starts with the letter C: True or False. The resulting filter will return a list […]

Read more
Python

Maintaining state while threading in Python

If you have ever worked with threading in Python before, you may have encountered issues where everything gets a little bit out of step (if you’re incrementing a counter, 2 threads may simultaneously try to increment it & mess up your program). So we can deal with that using queues. Let’s walk through an example […]

Read more