Skip to content

NameError: name 'warnings' is not defined #53

@irahulroy

Description

@irahulroy

I am getting the following error, although I did import the warnings library! Not sure what is going on!


NameError Traceback (most recent call last)
Cell In[44], line 2
1 # fit model
----> 2 did_fit = ATTgt(yname = 'y', tname = 'timestamp', idname = 'NumericID', gname = 'InterventionDate01',
3 xformla = 'y ~ Month',
4 data = df2, panel = True, control_group = "notyettreated", allow_unbalanced_panel = True).fit(est_method = 'reg')

File ~/.local/lib/python3.10/site-packages/csdid/att_gt.py:24, in ATTgt.init(self, yname, tname, idname, gname, data, control_group, xformla, panel, allow_unbalanced_panel, clustervar, weights_name, anticipation, cband, biters, alp)
19 def init(self, yname, tname, idname, gname, data, control_group = ['nevertreated', 'notyettreated'],
20 xformla: str = None, panel = True, allow_unbalanced_panel = True,
21 clustervar = None, weights_name = None, anticipation = 0,
22 cband = False, biters = 1000, alp = 0.05
23 ):
---> 24 dp = pre_process_did(
25 yname=yname, tname = tname, idname=idname, gname = gname,
26 data = data, control_group=control_group, anticipation=anticipation,
27 xformla=xformla, panel=panel, allow_unbalanced_panel=allow_unbalanced_panel, cband=cband, clustervar=None, weights_name=None
28 )
30 dp['biters'] = biters
31 dp['alp'] = alp

File ~/.local/lib/python3.10/site-packages/csdid/attgt_fnc/preprocess_did.py:167, in pre_process_did(yname, tname, idname, gname, data, control_group, anticipation, xformla, panel, allow_unbalanced_panel, cband, clustervar, weights_name)
165 if len(gsize) > 0:
166 gpaste = ",".join(map(str, gsize[gname]))
--> 167 warnings.warn(f"Be aware that there are some small groups in your dataset.\n Check groups: {gpaste}.")
169 if 0 in gsize[gname].to_numpy() and control_group == "nevertreated":
170 raise "Never-treated group is too small, try setting control_group='notyettreated'."

NameError: name 'warnings' is not defined

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions