benmiroglio / pymatch

MIT License
276 stars 129 forks source link

m.fit_scores #47

Open yceny opened 3 years ago

yceny commented 3 years ago

I got errors when calling m.fit_scores(balance = True, nmodels = 10)

Static column dropped: yr_nbrTraceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/builtins.py", line 87, in Q
    return env.namespace[name]
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/eval.py", line 51, in __getitem__
    raise KeyError(key)
KeyError: 'purchase_yr_nbr'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/compat.py", line 36, in call_and_wrap_exc
    return f(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/eval.py", line 166, in eval
    + self._namespaces))
  File "<string>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/builtins.py", line 89, in Q
    raise NameError("no data named %r found" % (name,))
NameError: no data named 'purchase_yr_nbr' found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tracy/Downloads/pymatch-master/pymatch/Matcher.py", line 109, in fit_scores
    y_samp, X_samp = patsy.dmatrices(self.formula, data=df, return_type='dataframe')
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/highlevel.py", line 310, in dmatrices
    NA_action, return_type)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/highlevel.py", line 165, in _do_highlevel_design
    NA_action)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/highlevel.py", line 70, in _try_incr_builders
    NA_action)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/build.py", line 696, in design_matrix_builders
    NA_action)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/build.py", line 443, in _examine_factor_types
    value = factor.eval(factor_states[factor], data)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/eval.py", line 566, in eval
    data)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/eval.py", line 551, in _eval
    inner_namespace=inner_namespace)
  File "/opt/anaconda3/lib/python3.7/site-packages/patsy/compat.py", line 43, in call_and_wrap_exc
    exec("raise new_exc from e")
  File "<string>", line 1, in <module>
patsy.PatsyError: Error evaluating factor: NameError: no data named 'purchase_yr_nbr' found
    Q('adas') ~ Q('car_age_month')+Q('day_mileage')+Q('engn_size')+Q('est_hh_incm_prmr_cd')+Q('gmqualty_model')+Q('input_indiv_gndr_prmr_cd')+Q('latitude1')+Q('longitude1')+Q('purchase_lat1')+Q('purchase_lng1')+Q('purchase_mth_nbr')+Q('purchase_yr_nbr')+Q('purchaser_age_at_tm_of_purch')+Q('umf_xref_finc_gbl_trim')
BaymaxBei commented 2 years ago

I got the same error.