Efficient way of collecting sum of missing values per row in Pandas

While doing project assigned from the Udacity Nanodegree program I’m currently attending, I had to collect the number of null values in each row and display it in the histogram. However, the Pandas dataset contained 891221 rows, which I had to wait quite a long time to iterate through the rows using the following code:

df.apply(lambda row: sum_of_nulls_in_row(row), axis=1)

Although it was suggested in this post that using apply() is much faster than using iterrow(), it was still too slow to finish the project efficiently. After several search, I found this discussion. In Icyblade‘s answer, he mentioned this:

When using pandas, try to avoid performing operations in a loop, including applymapapplymapetc. That’s slow!

Icyblade’s suggestion was to use following code:


df.isnull().sum(axis=1)

I’ve applied it into my code, and Boom! It worked like a charm. Long waiting was eliminated and the result was there in a blink. A good lesson learned.

Vocabulary Memorizing Helper App: VocaLerne

Early this year, I started learning German after work. As many people have said German is really hard to learn, one of the hard parts for me was memorizing all the new words they teach me on each class. To practice web development as well as to practice using Google Firebase, I made this web app called ‘VocaLerne’ (Voca + Lerne).

It is very simple app: you login to the app using Google ID and insert words and its meanings, and be able to call the saved words by clicking ‘load’ button. The app calls the word randomly from the Firebase.

Screen Shot 2017-10-05 at 7.46.39 PM.png
App showing one German word and some buttons, and total word status. By tapping the word, users can see the meaning of the word they inserted in.

 

Now the source code of this application is on Github (https://github.com/hodgoong/vocalerne). Most of the operations including random word selection are done on the front-end side, and it makes the application slow when the internet speed isn’t so fast enough. My plan is to version this up by using my own back-end system with MEAN stack next year. The running example can be found from here. User can use it on any browser including mobile devices.

The source code of Project Owl is on the Github now!

Project Owl was a small Grasshopper plugin that I developed during my master’s study. However, some might have already noticed that I stopped working on it for a while. I was really passionate about this project (I am generally very interested in reality capturing), but when I lost my most up-to-date WIP source code, I lost the passion as well. The situation wasn’t so great at that moment because I lost my MacBook at the same time. Yes, that’s how I’ve lost the source code, and it was all because I didn’t use the Github to back-up and share it with others.

Recently, I found out that some people actually visited my site to get the information about this tool. All the traffics were coming from the Grasshopper3D website (related post). So I thought why bury it deep in my computer when there are some other people who might need it? So I decided to upload the source code on the Github (https://github.com/hodgoong/grasshopper-kinect2) publically.

The code I’ve uploaded there is, as far as I remember, the very first working code which wasn’t optimized at all in terms of its performance. So I assume there will be many bugs (I beg not to blame my poor coding skill too much), but I believe smart people can figure things out and update the code. I hope I can work on this code soon again as well.

Project Owl with Volvox

So I’ve tried Owl with Volvox, which has been developed as a part of DURAARK project at the Center for Information Technology and Architecture (CITA) by Henrik Leander Evers and Mateusz Zwierzycki (http://www.grasshopper3d.com/group/volvox), and found out it’s much convenient to navigate scanned point clouds in the Rhino with these two combination.

Basically Volvox can turn array of points into Rhino point cloud type, which is lighter compare to have a sets of points. Have a try!

Update: source code of Project Owl is now publically open. Follow the link below for the code as well as the binary GHA file!

https://github.com/hodgoong/grasshopper-kinect2

Owl with Volvox

Project Owl: Kinect V2 Point Cloud Generator for Grasshopper

The contents has been relocated. Please visit below blog: https://hojoongchung.blogspot.com/2020/02/project-owl-kinect-v2-point-cloud.html

Project Owl: A Grasshopper point cloud generator for Microsoft Kinect V2 sensor has been updated.

Capture