How to use the activitysim.core.inject.column function in activitysim

To help you get started, we’ve selected a few activitysim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ActivitySim / activitysim / example / extensions / households.py View on Github external
@inject.column('households')
def hhsize(households):
    return households.PERSONS
github ActivitySim / activitysim / example / extensions / households.py View on Github external
@inject.column("households")
def num_children(households, persons):
    return persons.local.query("5 <= age <= 15").\
        groupby("household_id").size().\
        reindex(households.index).fillna(0)
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column("persons")
def num_disc_j(persons):
    return pd.Series(0, persons.index)
github ActivitySim / activitysim / example / extensions / landuse.py View on Github external
@inject.column("land_use")
def employment_density(land_use):
    return land_use.total_employment / land_use.total_acres
github ActivitySim / activitysim / example / extensions / landuse.py View on Github external
@inject.column("land_use")
def total_employment(land_use):
    return land_use.local.TOTEMP
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column("persons")
def is_university(persons):
    return persons.pstudent == PSTUDENT_UNIVERSITY
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column("persons")
def nonstudent_to_school(persons):
    return (persons.ptype.isin([PTYPE_FULL, PTYPE_PART, PTYPE_NONWORK, PTYPE_RETIRED]) &
            persons.pstudent.isin([PSTUDENT_GRADE_OR_HIGH, PSTUDENT_UNIVERSITY]))
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column("persons")
def student_is_employed(persons):
    return (persons.ptype.isin([PTYPE_UNIVERSITY, PTYPE_DRIVING]) &
            persons.pemploy.isin([PEMPLOY_FULL, PEMPLOY_PART]))
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column('persons')
def has_non_worker(persons):
    return presence_of(PTYPE_NONWORK, persons)
github ActivitySim / activitysim / example / extensions / persons.py View on Github external
@inject.column("persons")
def male(persons):
    return persons.sex == 1