question 446 Data Formats & Analytical Workflows · medium
The zone name with an apostrophe
zone_id_for looks up a zone's ID by its exact name in a SQLite table. It works for most zones but crashes for Eltingville/Annadale/Prince's Bay with OperationalError (or DatabaseError). Fix it so any name works, and return None for a name that isn't in the table.
Function
zone_id_for(conn, name)conna sqlite3 connection with a table
zones(zone_id, zone_name, borough)Returnsthe zone ID (int), or
None