File: add_predictors.py

package info (click to toggle)
patsy 0.4.1%2Bgit34-ga5b54c2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,444 kB
  • ctags: 884
  • sloc: python: 8,797; makefile: 130; sh: 15
file content (7 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
def add_predictors(base_formula, extra_predictors):
    desc = ModelDesc.from_formula(base_formula)
    # Using LookupFactor here ensures that everything will work correctly even
    # if one of the column names in extra_columns is named like "weight.in.kg"
    # or "sys.exit()" or "LittleBobbyTables()".
    desc.rhs_termlist += [Term([LookupFactor(p)]) for p in extra_predictors]
    return desc