Excel confusing CSV file with SYLK file

I recently had an interesting experience whilst using pandas to write some data to a CSV file and then opening the file up with Excel to inspect its contents. To my surprise, I received a message from Excel informing me that I was attempting to open something called a ‘SYLK file’.

Read More
Using VNC to view the Raspberry Pi GUI

One of my side projects has involved playing around with the camera on a Raspberry Pi and I realised that it would be handy to see the camera output. After finding out that VNC tight server would do the job, the first step was to install it on the Raspberry Pi: With that done, I …

Read More
Finding rows in dataframe with a 0 value using Pandas

Recently I needed to identify which of the rows in a CSV file contained 0 values. This was interesting because normally I tend to look at this problem within columns rather than rows. Pandas provides a neat solution to this which I’ll demonstrate below using this data as an example: This data frame should look …

Read More
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
Never trust your factors

I recently helped a friend out with a dataset – she was struggling to merge the CSV files from two dataframes in R into one dataframe. I thought this would be quite simple and yet could not get it to work with merge or dplyr – it just kept giving me weird results. The problem was …

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
Compiling C++ Code Using Caffe

As part of my PhD project, I have been writing a program in C++ to track hundreds of bees that I have tagged and to identify the pattern on the tags. Initially, I had thought that recognising the tags would be rather simplistic – I could threshold out the tags that are reflective under IR …

Read More
Be careful with FFmpeg metadata

Recently I used the program FFmpeg to automatically extract metadata about the time and date some videos I’ve been using for my research were created. FFmpeg is a really useful tool for manipulating videos and images at the command-line. You can do things like change the format, quality or length of your video files with relative …

Read More