Member-only story
DATA ANALYTICS LIKE A PYTHON PRO
Pandas Tips & Tricks: Need For Speed
A Personal Favorite 1-Liner
Overview
My last post demonstrated a simple process for evaluating a set of face pairs to determine whether or not the two are blood relatives. Several snippets were breezed over like black boxes. Let us look at one of those snippets, a simple 1-liner: a Python Pandas feature I recently learned and now use frequently.
The DataFrame contains the list of face pairs p1 and p2 (Fig. 1) and features (type dict) with filenames as the keys and face encodings as values.
So there you are! In just 1 line of code, we apply a scoring metric to millions of pairs without memory or speed concerns while creating a column for scores for pairs as part of the same DataFrame.