API Reference

Parser

class nycparser.nycparser.Parser[source]

Bases: object

__init__()[source]
address(address: str) Dict[str, Any][source]

Parses a single line input address.

Parameters:

address – A single line input address with PHN and Street, ex. “100 Gold St.”

Returns:

A dictionary with PHN, STREET, BOROUGH_CODE, BOROUGH_NAME, ZIP

Examples

>>> parser = Parser()
>>> parser.address("100 Gold St, Manhattan, NY 10038")
{'PHN': '100', 'STREET': 'GOLD ST', 'BOROUGH_CODE': 1, 'BOROUGH_NAME': 'MANHATTAN', 'ZIP': '10038'}
bbl(bbl: str | int) Dict[str, Any][source]

Parses a single line input BBL (Borough-Block-Lot).

Parameters:

bbl – A single line input bbl. Can contain special characters, just needs 10 digits.

Returns:

A dictionary with BOROUGH_CODE, BLOCK, LOT and BOROUGH_NAME

Raises:

ValueError – If the BBL doesn’t contain exactly 10 digits or has an invalid borough code.

Examples

>>> parser = Parser()
>>> parser.bbl("1-01234-0001")
{'BOROUGH_CODE': 1, 'BLOCK': 1234, 'LOT': 1, 'BOROUGH_NAME': 'MANHATTAN'}