Entrepreneurial Geekiness

Ian is a London-based independent Chief Data Scientist who coaches teams, teaches and creates data products. More about Ian here.
Entrepreneurial Geekiness
Ian is a London-based independent Chief Data Scientist who coaches teams, teaches and creates data products.

“Flying Pandas” and “Making Pandas Fly” – virtual talks this weekend on faster data processing with Pandas, Modin, Dask and Vaex

This Saturday and Monday I’ve had my first experience presenting at virtual conferences – on Saturday it was for Remote Pizza Python (brilliant line-up!) and on Monday (note – this post predates the talk, I’ll update it tomorrow after I’ve spoken) at BudapestBI. UPDATE added 2nd variant of Making Pandas Fly for a short-notice PyDataUK talk too.

My slides for Remote Pizza Python are here “Flying Pandas – Modin, Dask & Vaex“. I cover the following in a 10 min talk:

  • Modin – new academic project, makes a new algebra for dataframes (not just Pandas), provides automated column & row parallelisation options for no code changes
  • Dask – great for blocked Pandas DataFrames in parallel on 1 or more machines (it can also parallelise on a single machine multi-core with in-RAM data which I didn’t cover)
  • Vaex – new Pandas-like DataFrame with a subset of operations, better string implementation so you fit more strings into RAM than with Pandas
  • I recommended sticking to Pandas if your code fits in RAM, trying Modin if you have it in RAM or using Dask if you have a bigger-than-RAM scenario, with Vaex being great for an experiment

The reaction was very positive and on the internal Discord chat we had some great Q&A about the use of Numba, Dask, Modin and other tools.

For PyDataBudapest I gave a longer 30 min talk on Making Pandas Fly (GitHub source as Notebooks for both parts):

  • Dask to preprocess larger dataset with nice diagnostics
  • Pandas – using Category and float32 or float16 to save RAM and to do faster lookups
  • Pandas – dropping to NumPy to calculate numeric operations faster with a look at James Powell’s great callgraph prototype to dig into the call history complexity
  • Pandas – using Numba to accelerate numeric functions

The remote talk to Budapest was slightly hampered by a chunk of the Virgin internet backbone disappearing just before I spoke, thankfully we got it back a few minutes later (else I was going to live present, with a live Dask demo, tethered via a 4G mobile connection!). I had some great questions from the Budapest audience – thanks for having me!

For PyDataUK, our inaugural event this week (a week after the two talks above) I gave a variant of Making Pandas Fly to 250 live streamers, oragnised by the lovely crowd at PyDataManchester. The YouTube link is available (via the meetup page), Paige Bailey of Google was the lead speaker on TensorFlow Probability which was an intriguing talk (sadly yet another thing I’ll run out of time before trying).

Thanks to James Powell for his CallGraph code (uploaded here) to show how many extra calls Pandas might add onto a NumPy operation on a column.

The sensible outcomes of both talks are:

  • Use Dask to preprocess large datasets that don’t fit into RAM
  • Use Pandas intelligently to save RAM and make your manipulations run faster for investigatory work
  • Look at Modin to see if making no changes to your code can result in speed-ups on larger in-RAM datasets
  • Check Vaex if you have large memory mapped (HDF5) datasets or if you want faster string processing

Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.
Read More

Recent “week notes”

I’ve not done a public “week notes” before. I’ve been hacking on various things and I figure it is worth sharing some of it.

Using public Companies House data I’ve started to plot the decline in new company formations in the UK. Here’s a first crack, which shows a decline at the end of March. This data comes monthly as a single dump so it didn’t contain April. Here’s a second crack going back 10 years, it shows co-ordinated drops in activity during UK public holidays (and this March still looks awful).

For this third crack I’ve used the Companies House API to augment the static dump with up-to-date data for April (which’ll be replaced when the new data dump is provided in a week). There’s a 3 week current window showing “no dissolutions” which I suspect means they’ve not been added to the public database, the decline in registrations is clear. I’m guessing registrations go via a different human process than dissolutions and dissolutions might be very laggy due to admin.

In Pandas I learned about the “memory_usage” function which gives a per-column memory report. Benjamin noted that this appears in Dask and CuDF too in a reply.

For my upcoming Remote Pizza Python talk (tomorrow) on Modin, Dask & Vaex I’ve delved further into Modin and Dask. The Modin folk gave useful feedback for “how Modin is working” and I’ve got an open question on Dask on stackoverflow regarding memory usage.

On Monday I give a talk remotely for PyDataBudapest which focuses more on how to get more out of Pandas on a smaller-data scenario. Experiences for both of these talks will go into my upcoming Higher Performance Python training (start of June).

My garden is doing well – I’m now eating my new radishes. Kilos of flour will arrive soon so I can expand my bread making experiments too!

Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.
Read More

New Higher Performance Python class (June 1-3)

I’ve listed my next Higher Performance Python public class, it’ll run online for 3 mornings on June 1-3 during UK hours. We’ll use Zoom and Slack with pre-distributed Notebooks and modules and you’ll run it using an Anaconda environment. Here’s the write-up from my recent class.

We’ll focus on

  • Profiling to find what’s slow in your code so you spend your time fixing the right things (this is so important, our intuitions are always wrong!)
  • Switching to NumPy to get benefits from vectorisation
  • Compiling with Numba to get C-like speeds for very little effort (we’ll get a 200x speed-up overall)
  • Run in parallel with OpenMP and with JobLib to take advantage of multiple cores
  • Learn slow and faster ways of solving problems in Pandas (we’ll see a massive speed-up once we go slightly “under the covers” with Pandas and avoid doing silly access operations)
  • Use Numba compiled functions to process Pandas data (using the raw=True trick)
  • Use Dask to process Pandas in parallel to use all your cores when your data fits in RAM
  • Look into using Dask to process bigger-than-RAM datasets
  • Review other tooling and process options to make you generally more performant in your work

Feel free to contact me if you have questions about the course. I’m currently not planning to run another iteration of this for some months (possibly October for the next one).

Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.
Read More

Notes on last week’s Higher Performance Python class

Last week I ran a two-morning Higher Performance Python class, we covered:

  • Profiling slow code (using a 2D particle infection model in an interactive Jupyter Notebook) with line_profiler & PySpy
  • Vectorising code with NumPy vs running the original with PyPy
  • Moving to Numba to make iterative and vectorised NumPy really fast (with up to a 200x improvement on one exercise)
  • Ways to make applying functions in Pandas much faster and multicore (with Dask & Swifter, along with Numba)
  • Best practice for each tool
  • Excellent discussion where I got taught a few new tips too (and in part this is why I love teaching smart crowds!)

If you’d like to hear about the upcoming iterations please join my low-volume training announce list and I offer a discount code in exchange for you spending two minutes filling in this very brief survey about your training needs.

Working through the exercises from day 1 of the high performance python course from. Who knew there was so much time to shave off from functions I use every day?.. apart from Ian of course” – Tim Williams

Here’s my happy class on the first morning:

Class attendees

We used Zoom to orchestrate the calls with a mix of screen-share for my demos and group discussion. Every hour we took a break, after the first morning I set some homework and I’m waiting to hear how the take-home exercise will work out. In 2 weeks we’ll have a follow-up call to clear up any remaining questions. One thing that was apparent was that we need more time to discuss Pandas and “getting more rows into RAM” so I’ll extend the next iteration to include this. A little of the class came directly from the 2nd edition of my High Performance Python book with O’Reilly (due out in May), almost all of it was freshly written for this class.

In the class Slack a bunch of interesting links were shared, we got to discuss how several people use Numba in their companies with success. Whilst I need to gather feedback from my class it feels like the “how to profile your code so you focus your effort on the real bottlenecks” was the winner from this class, along with showing how easily we can use Numba to speed up things in Pandas (if you know the “raw=True” trick!).

I plan to run another iteration of this class, along with online-only versions of my Successfully Delivering Data Science Projects & Software Engineering for Data Scientists – do let me know, or join my training email list, if you’d like to join.



Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.
Read More

Notes from Zoom call on “Problems & Solutions for Data Science Remote Work”

On Friday I held an open Zoom call to discuss the problems and solutions posed by remote work for data scientists. I put this together as I’ve observed from my teaching cohorts and from conversation with colleagues that for anyone “suddenly working remotely” the process has typically not been smooth. I invited folk to join and asked that they shared 1 pain and 1 tip via a GForm, some tips were also submitted via Twitter. We held a live video chat and I took notes, I’ve summarised these below.

Given that we’re likely to stay in this remote mode for a minimum of 3 months, possibly 6 months and to a greater & lesser extent over 1-2 years it’ll pay for your team to invest in building a good remote process.

This post by Chris Parsons at Gower covers a CTO’s view of collaboration in a tech org (including data scientists), I like the notion of relinquishing control and discouraging continual availability.

I was joined by Jon Markwell (@jot), founder of The Skiff co-working environment down in Brighton (he’s built a brilliant community of freelancers there who often work remotely). He helps companies with their remote transformations. He’s been working on a new tool for remote readiness prior to Coronavirus and I invited him to share his tech-focused remote practices on the call. He’s open to you reaching out via Twitter or LinkedIn if you’d like his advice.

We spoke at a high level on:

  • Well-being
  • Avoiding distactions and isolation
  • Team discussions
  • Whiteboarding, tools, knowledge sharing

Well-being came up frequently in my “share 1 problem and 1 tip”. Tips included:

  • Getting a manager to set the tone that “it is ok to work at a slower pace, take it easy, adapting takes time” is important to help folk reduce stress. Saying “I’m in” and “I’m out” in slack can indicate clear working hours for the team to help everyone know when folk are around or not, this helps when there are core-hours that everyone should maintain in distributed teams
  • Building up a back-log of tasks for lower priority but important work like back-filling tests, refactoring and reviewing untouched code is a good way to provide important but low-stress tasks that a colleague can take on when they’re feeling less productive such that a positive outcome is still achieved
  • Make a routine and stick to it. Maybe go for a walk first-thing prior to work to simulate a commute. Put on your “work clothes” rather than PJs.
  • Figuring out processes to keep morale up is a team-wide issue. Overwork should be watched for just like underworking. A “#wellbeing” slack channel at work might be a good place to share fun things, possibly with a “#covid19” channel kept separate to keep that news in 1 place (where it can also be avoided)
  • For teams that don’t know each other Federico suggested GeoGuessr as a simple game that all can play on Zoom to break the ice

Distractions and isolation was also a frequent issue:

  • Many of us on the call use the Pomodoro timed technique (working for 25 minutes via a timer then taking a short break), Sandrine suggested this physical timer and I use the countdown timer on my phone
  • To avoid websites Flipd was suggested for phone focus, Freedom (now banned by Apple apparently) and Bertil suggested SelfControl (Mac) to limit website interaction

Team communication was more tricky:

  • A frequently cited issued was the loss of ad-hoc in-person communication for discussion
  • Jon reminded everyone on the importance of over-communicating whilst the team adapted with a focus on transparency to avoid people feeling left out
  • Severin noted keeping core hours was helpful
  • I suggested that if team members and bosses were unsure about how a remote process might work to point them at large, decentralised and demonstrably-capable teams like those behind the open source scikit-learn, Pandas and Linux projects. The newsgroups, occasional calls and github-fueled process work very well
  • Calls need to be controlled – establish an agenda and a protocol for asking questions (perhaps using chat simultaneously)
  • Have an always-open video call where folk can just drop-in and natter might simulate some of the relaxed chat in an office


  • A kanban/scrum process will work fine in a remote scenario, Trello boards work well (if you don’t have a system yet – columns like “ideas”, “blocked”, “in process”, “done” where they move left->right is a sensible basic flow)
  • Tools noted include Miro (collaborative whiteboard), TandemChat (team chat), Slack or Microsoft Teams, Google suite during a video call
  • Jon gave us a demo of Retrium for remote retrospectives, this looks fairly powerful and has a free 30 day trial
  • Jon also showed us the output of his Remote Readiness tool which can help a team score where they’re good & bad for the move to remote – this will certainly help managers spot areas of weakness that they can avoid, given Jon’s prior experience (also – contact Jon if you’d like his advice!)

Home office setup (we didn’t get to discuss this):

  • A physical cable to the router is likely to be more stable than wifi if you’re a distance from your router (I use 15m of cat-5e cable)
  • I also have a Netgear EX6120 range extender but neighbours now have similar so I prefer to depend on the physical cable
  • I use a Logitech C920 HD camera (the C920S seems to be the newer version) which has auto-focus and “just works” with my Linux, it sits on top of my external monitor
  • I’ve also got a comfy wired headset with microphone (wired as having a battery fail during a call is less helpful)
  • Some people use a greenscreen as they hate having their home on display (this is discussed in his hackernews thread)

Thoughts on the format of the Zoom call:

  • This is the first time I’ve done a discussion like this, getting feedback from a group who don’t know each other was hard
  • Prior to the call I created an agenda, agreed with my co-presenter, based on the GForm feedback
  • At the start of the call everyone introduced themselves in the Zoom chat window (name, company, city) and I explained everyone should stay on mute unless they had a point to raise
  • The fact that I knew 50% of the participants is great, it would have been much more wooden I feel if the number had been smaller
  • Getting folk to contribute ideas was hard, maybe asking folk to physically raise a hand is a good indicator (for those with video on – about 1/3 of the attendees), maybe using Zoom’s “raise hand” is useful, or maybe reminding frequently that folk can share questions into the Zoom chat would help
  • Once you close the meeting your Chat history seems to be deleted – this is awful, I lost some of the notes I hadn’t copied over and I couldn’t see a way to retrieve them
  • Having Jon Markwell along was great, having a “guest co-presenter” is important and he’s got a ton of useful experience

Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.
Read More