Beispiel #1
0

## Register output table.


@sim.table(cache=True)
def parcels_out(parcels_in):
    index = pd.Series(parcels_in.index).dropna().unique()
    df = pd.DataFrame(index=index)
    df.index.name = 'apn'
    return df


## Register output columns.

out = sim.column('parcels_out', cache=True)


@out
def county_id():
    return '081'


@out
def parcel_id_local():
    pass


@out
def land_use_type_id(code='situs.USE_CODE'):
    return code
Beispiel #2
0
## Register intermediate table and columns.

# The purpose of this intermediate table is to compute certain fields,
# like non_residential_sqft and residential_units, before grouping together
# records with the same parc_py_id. Thus, single-family condominium units
# would each be assumed to have one residential unit, and this count would
# be summed when grouping later.


@sim.table()
def parcels_in2(parcels_in):
    return pd.DataFrame(index=parcels_in.index)


in2 = sim.column('parcels_in2', cache=True)


@in2
def res_type2(land_use_type_id='parcels_in.use_code'):
    return utils.get_res_type(land_use_type_id, res_codes)

@in2
def building_sqft2(bldg_sqft='parcels_in.bldg_sqft', tla='parcels_in.tla'):
    # Alternate inputs:
    # - "NET_RNT_AR"
    sqft = pd.concat([bldg_sqft, tla])
    return sqft.groupby(level=0).max()


@in2