csdid 0.2.7__tar.gz → 0.2.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {csdid-0.2.7 → csdid-0.2.9}/PKG-INFO +2 -2
  2. csdid-0.2.9/csdid/_version.py +1 -0
  3. {csdid-0.2.7 → csdid-0.2.9}/csdid/att_gt.py +0 -1
  4. {csdid-0.2.7 → csdid-0.2.9}/csdid/attgt_fnc/preprocess_did.py +1 -2
  5. {csdid-0.2.7 → csdid-0.2.9}/csdid/plots/gplot.py +38 -15
  6. {csdid-0.2.7 → csdid-0.2.9}/csdid.egg-info/PKG-INFO +2 -2
  7. {csdid-0.2.7 → csdid-0.2.9}/csdid.egg-info/requires.txt +1 -1
  8. {csdid-0.2.7 → csdid-0.2.9}/setup.py +2 -3
  9. csdid-0.2.7/csdid/_version.py +0 -1
  10. {csdid-0.2.7 → csdid-0.2.9}/LICENSE +0 -0
  11. {csdid-0.2.7 → csdid-0.2.9}/csdid/__init__.py +0 -0
  12. {csdid-0.2.7 → csdid-0.2.9}/csdid/aggte_fnc/__init__.py +0 -0
  13. {csdid-0.2.7 → csdid-0.2.9}/csdid/aggte_fnc/aggte.py +0 -0
  14. {csdid-0.2.7 → csdid-0.2.9}/csdid/aggte_fnc/compute_aggte.py +0 -0
  15. {csdid-0.2.7 → csdid-0.2.9}/csdid/aggte_fnc/utils.py +0 -0
  16. {csdid-0.2.7 → csdid-0.2.9}/csdid/attgt_fnc/__init__.py +0 -0
  17. {csdid-0.2.7 → csdid-0.2.9}/csdid/attgt_fnc/compute_att_gt.py +0 -0
  18. {csdid-0.2.7 → csdid-0.2.9}/csdid/plots/__init__.py +0 -0
  19. {csdid-0.2.7 → csdid-0.2.9}/csdid/utils/__init__.py +0 -0
  20. {csdid-0.2.7 → csdid-0.2.9}/csdid/utils/bmisc.py +0 -0
  21. {csdid-0.2.7 → csdid-0.2.9}/csdid/utils/mboot.py +0 -0
  22. {csdid-0.2.7 → csdid-0.2.9}/csdid.egg-info/SOURCES.txt +0 -0
  23. {csdid-0.2.7 → csdid-0.2.9}/csdid.egg-info/dependency_links.txt +0 -0
  24. {csdid-0.2.7 → csdid-0.2.9}/csdid.egg-info/top_level.txt +0 -0
  25. {csdid-0.2.7 → csdid-0.2.9}/setup.cfg +0 -0
  26. {csdid-0.2.7 → csdid-0.2.9}/test/test_vs_r.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csdid
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Difference in Difference in Python
5
5
  Home-page: https://github.com/d2cml-ai/csdid
6
6
  Author: D2CML Team, Alexander Quispe, Carlos Guevara, Jhon Flroes
@@ -13,7 +13,7 @@ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Topic :: Scientific/Engineering
14
14
  License-File: LICENSE
15
15
  Requires-Dist: pandas
16
- Requires-Dist: numpy<=1.24.3
16
+ Requires-Dist: numpy
17
17
  Requires-Dist: scipy
18
18
  Requires-Dist: patsy
19
19
  Requires-Dist: plotnine
@@ -0,0 +1 @@
1
+ __version = '0.2.9'
@@ -32,7 +32,6 @@ class ATTgt:
32
32
  dp['alp'] = alp
33
33
  dp['true_repeated_cross_sections'] = dp['true_rep_cross_section']
34
34
  dp['cband'] = cband
35
- dp['panel'] = panel
36
35
  self.dp = dp
37
36
 
38
37
  def fit(self, est_method = 'dr', base_period = 'varying', bstrap = True):
@@ -261,7 +261,6 @@ def pre_process_did(yname, tname, idname, gname, data: pd.DataFrame,
261
261
  n, t = data.shape
262
262
  control_group = control_group[0]
263
263
  columns = [idname, tname, yname, gname]
264
- control_group = "nevertreated"
265
264
  # print(columns)
266
265
  # Columns
267
266
  if clustervar is not None:
@@ -426,4 +425,4 @@ def pre_process_did(yname, tname, idname, gname, data: pd.DataFrame,
426
425
  'true_rep_cross_section': true_rep_cross_section,
427
426
  'clustervars': clustervar
428
427
  }
429
- return did_params
428
+ return did_params
@@ -15,27 +15,42 @@ def gplot(ssresults, ax, ylim=None, xlab=None, ylab=None, title="Group", xgap=1,
15
15
  if ylab is None:
16
16
  ylab = 'ATT'
17
17
 
18
+ # drop any null years, then overwrite 'year' cleanly as integer
18
19
  ssresults = ssresults[ssresults['year'].notnull()].copy()
19
- ssresults.loc[:, 'year'] = ssresults['year'].astype(int).astype(str)
20
+ ssresults = ssresults.assign(year=ssresults['year'].astype(int))
20
21
 
21
- pre_points = ssresults.loc[ssresults['post'] == 0]
22
- post_points = ssresults.loc[ssresults['post'] == 1]
23
-
24
- ax.errorbar(pre_points['year'], pre_points['att'], yerr=pre_points['c']*pre_points['att_se'],
25
- fmt='o', markersize=5, color='#e87d72', ecolor='#e87d72', capsize=5, label='Pre')
22
+ pre_points = ssresults[ssresults['post'] == 0]
23
+ post_points = ssresults[ssresults['post'] == 1]
26
24
 
27
- ax.errorbar(post_points['year'], post_points['att'], yerr=post_points['c']*post_points['att_se'],
28
- fmt='o', markersize=5, color='#56bcc2', ecolor='#56bcc2', capsize=5, label='Post')
25
+ # plot Pre
26
+ ax.errorbar(
27
+ pre_points['year'].to_numpy(),
28
+ pre_points['att'].to_numpy(),
29
+ yerr=(pre_points['c'] * pre_points['att_se']).to_numpy(),
30
+ fmt='o', markersize=5,
31
+ color='#e87d72', ecolor='#e87d72',
32
+ capsize=5, label='Pre'
33
+ )
34
+ # plot Post
35
+ ax.errorbar(
36
+ post_points['year'].to_numpy(),
37
+ post_points['att'].to_numpy(),
38
+ yerr=(post_points['c'] * post_points['att_se']).to_numpy(),
39
+ fmt='o', markersize=5,
40
+ color='#56bcc2', ecolor='#56bcc2',
41
+ capsize=5, label='Post'
42
+ )
29
43
 
30
44
  ax.set_ylim(ylim)
31
45
  ax.set_title(title)
32
- ax.set_xlabel(xlab)
33
- ax.set_ylabel(ylab)
46
+ ax.set_xlabel(xlab)
47
+ ax.set_ylabel(ylab)
34
48
 
35
- handles, labels = ax.get_legend_handles_labels()
49
+ handles, labels = ax.get_legend_handles_labels()
36
50
 
37
51
  if ref_line is not None:
38
52
  ax.axhline(ref_line, linestyle='dashed', color='#1F1F1F')
53
+
39
54
  if theming:
40
55
  ax.set_facecolor('white')
41
56
  ax.set_title(title, color="#1F1F1F", fontweight="bold", fontsize=10)
@@ -43,18 +58,26 @@ def gplot(ssresults, ax, ylim=None, xlab=None, ylab=None, title="Group", xgap=1,
43
58
  ax.spines['left'].set_color('#1F1F1F')
44
59
  ax.tick_params(axis='x', colors='#1F1F1F')
45
60
  ax.tick_params(axis='y', colors='#1F1F1F')
61
+
62
+ # draw legend below if both series exist
46
63
  if not pre_points.empty and not post_points.empty:
47
- ax.legend(handles[0:2], labels[0:2], loc='lower center',fontsize='small', ncol=2, bbox_to_anchor=(0.5,-0.27))
64
+ ax.legend(handles[0:2], labels[0:2],
65
+ loc='lower center', fontsize='small',
66
+ ncol=2, bbox_to_anchor=(0.5, -0.27))
48
67
  elif not pre_points.empty:
49
- ax.legend(handles[:1], labels[:1], loc='lower center',fontsize='small', ncol=2, bbox_to_anchor=(0.5,-0.27))
68
+ ax.legend(handles[:1], labels[:1],
69
+ loc='lower center', fontsize='small',
70
+ ncol=2, bbox_to_anchor=(0.5, -0.27))
50
71
  elif not post_points.empty:
51
- ax.legend(handles[1:2], labels[1:2], loc='lower center',fontsize='small', ncol=2, bbox_to_anchor=(0.5,-0.27))
72
+ ax.legend(handles[1:2], labels[1:2],
73
+ loc='lower center', fontsize='small',
74
+ ncol=2, bbox_to_anchor=(0.5, -0.27))
75
+
52
76
  if not legend:
53
77
  ax.legend().set_visible(False)
54
78
 
55
79
  return ax
56
80
 
57
-
58
81
  def splot(ssresults, ax, ylim=None, xlab=None, ylab=None, title="Group",
59
82
  legend=True, ref_line=0, theming=True):
60
83
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csdid
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Difference in Difference in Python
5
5
  Home-page: https://github.com/d2cml-ai/csdid
6
6
  Author: D2CML Team, Alexander Quispe, Carlos Guevara, Jhon Flroes
@@ -13,7 +13,7 @@ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Topic :: Scientific/Engineering
14
14
  License-File: LICENSE
15
15
  Requires-Dist: pandas
16
- Requires-Dist: numpy<=1.24.3
16
+ Requires-Dist: numpy
17
17
  Requires-Dist: scipy
18
18
  Requires-Dist: patsy
19
19
  Requires-Dist: plotnine
@@ -1,5 +1,5 @@
1
1
  pandas
2
- numpy<=1.24.3
2
+ numpy
3
3
  scipy
4
4
  patsy
5
5
  plotnine
@@ -23,13 +23,12 @@ setup(
23
23
  ],
24
24
  install_requires=[
25
25
  'pandas',
26
- 'numpy<=1.24.3',
26
+ 'numpy',
27
27
  'scipy',
28
28
  'patsy',
29
29
  'plotnine',
30
30
  'twine',
31
- 'joblib',
32
- #'drdid @ git+https://github.com/d2cml-ai/DRDID'
31
+ 'joblib'
33
32
  ],
34
33
  packages=find_packages(),
35
34
  package_data={
@@ -1 +0,0 @@
1
- __version = '0.2.7'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes