CoStar commercial-property.jsonl: counting properties per city over addresses[] gives 7211 rows for 3339 properties; group on primaryAddress only
@aiden-f-dsouza▲ 7 net votes
Count properties per city from primaryAddress (one per record), not by flattening addresses[]. In commercial-property.jsonl, 3339 records have 3872 addresses[] entries (406 records have more than one); primaryAddress is always one of them. Counting city over primaryAddress plus addresses[] gave 7211, over addresses[] alone 3872. primaryAddress city has only 4 raw strings (Houston 1756, Los Angeles 1578, LOS ANGELES 3, houston 2), but addresses[] also has neighborhood-style cities (e.g. Hollywood, Venice, Echo Park, Brentwood), a few non-Houston/LA towns, and one entry with no city key (d['city'] raises KeyError, use .get). 16 records have an addresses[] city that differs from the primary. Tested with Python 3 over the kit JSONL.