When to use ‘is’ and ‘==’ in Python

One of the things that may seem confusing in Python is how there appears to be two ways to test if variables are the same: ‘==’ and ‘is’: Both comparison methods returned True, so they do the same thing right? Well, not really. To illustrate this, I’ll change the integer value assigned: Now we have …

Read More
Python object ids and mutable types

Did you know that every object in your Python program is given a unique identifier by the interpreter which you can return using the ‘id()’ function? Let’s see what happens when we assign variables to each other in Python and then print out the variable value and object id: Now I am printing out two …

Read More
Positioning a legend outside the figure with Matplotlib and Python

One of the things that has been a little frustrating lately has been what to do if you need a legend for your plot, yet there’s so much content on your plot you need to place it next to the figure, rather than within it.  The standard way to create a plot with the legend …

Read More
Python hmmlearn installation issues

I’ve recently started learning how to apply a Hidden Markov Model (HMM) to some states of honeybee behaviour in my data and have been trying to install Python’s hmmlearn library. Unfortunately I kept getting this frustrating error due to it being unable to locate NumPy headers: After a bit of searching I found the solution in a …

Read More
Interesting Readings

Work has kept me pretty busy lately but I’ve been meaning to try put together another post with some of the interesting readings I’ve come across. The first thing I’ll mention is that the IEEE (Institute of Electrical and Electronics Engineers) have released their rankings for programming language popularity. Python (ranked #4) and R (ranked #6) …

Read More
PyCon 2015 Talks I Found Interesting

Here are some of the PyCon 2015 talks I found rather interesting, please note that some of the talks that refer to machine learning have been linked to in my post here.

Read More
Learning the Flask Python Web Framework

Flask is a minimalist web framework written in Python that I’ve become rather intrigued by, and have been been reading up on in my spare time. Part of the appeal of this framework is that all you need to get a simple server going is this:

Read More
Writing idiomatic Python videos

I’ve been subscribed to Jeff Knupp’s Python programming blog for a while now, and have really enjoyed a lot of the content. He recently released a 3-part video series on writing idiomatic Python, which I highly recommend watching.

Read More
Best resources for learning OpenCV (Python and C++)

Here’s a list of some of the websites, books and videos (for both Python and C++), that I have found very useful while learning OpenCV. Python Using OpenCV with Python and ROS (Video) – Great introduction to computer vision and OpenCV. PyImageSearch – Website has a lot of great tutorials on many different applications of OpenCV. OpenCV-Python …

Read More
Using C++ or Python for OpenCV Programs

When I first started learning OpenCV, I was working exclusively with Python. While I am still a huge fan of the language, today all of my OpenCV programs are written in C++. Why? Some of the deeper functionality of OpenCV has not been completely ported to Python (although hopefully the release of OpenCV 3.0 will …

Read More