Skip to content

Commit

Permalink
Bugfix: Only create aggregate data frame when scale is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Blank committed Aug 20, 2024
1 parent 7eebd12 commit c0c2590
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions azcausal/estimators/panel/vdid.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,10 @@ def vdid_panel(dx, keys, targets, time, unit, fillna=None, **kwargs):
.assign(delta_treat=lambda dx: dx['post_treat'] - dx['pre_treat'])
.assign(did=lambda dx: dx['delta_treat'] - dx['delta_contr'])
)

dte['cum_agg'] = dte['avg_agg'] * dte['scale']
dte['pct_agg'] = dte['avg_agg'].div(dte['cf'].abs() / 100, axis='index')
if 'scale' in dte:
dte['cum_agg'] = dte['avg_agg'] * dte['scale']
if 'cf' in dte:
dte['pct_agg'] = dte['avg_agg'].div(dte['cf'].abs() / 100, axis='index')

return dte

Expand Down

0 comments on commit c0c2590

Please sign in to comment.