diffindiff 2.5.8__tar.gz → 2.5.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 (22) hide show
  1. {diffindiff-2.5.8 → diffindiff-2.5.9}/PKG-INFO +6 -9
  2. {diffindiff-2.5.8 → diffindiff-2.5.9}/README.md +5 -8
  3. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/config.py +3 -3
  4. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/didanalysis.py +17 -15
  5. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/diddata.py +4 -4
  6. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/didtools.py +11 -4
  7. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff.egg-info/PKG-INFO +6 -9
  8. {diffindiff-2.5.8 → diffindiff-2.5.9}/setup.py +1 -1
  9. {diffindiff-2.5.8 → diffindiff-2.5.9}/MANIFEST.in +0 -0
  10. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/__init__.py +0 -0
  11. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/didanalysis_helper.py +0 -0
  12. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/tests/__init__.py +0 -0
  13. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/tests/data/Corona_Hesse.xlsx +0 -0
  14. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/tests/data/counties_DE.csv +0 -0
  15. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/tests/data/curfew_DE.csv +0 -0
  16. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff/tests/tests_diffindiff.py +0 -0
  17. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff.egg-info/SOURCES.txt +0 -0
  18. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff.egg-info/dependency_links.txt +0 -0
  19. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff.egg-info/requires.txt +0 -0
  20. {diffindiff-2.5.8 → diffindiff-2.5.9}/diffindiff.egg-info/top_level.txt +0 -0
  21. {diffindiff-2.5.8 → diffindiff-2.5.9}/setup.cfg +0 -0
  22. {diffindiff-2.5.8 → diffindiff-2.5.9}/tests/test_diffindiff.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffindiff
3
- Version: 2.5.8
3
+ Version: 2.5.9
4
4
  Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
5
5
  Author: Thomas Wieland
6
6
  Author-email: geowieland@googlemail.com
@@ -47,7 +47,7 @@ A case study that utilizes the diffindiff library (preprint) is available on [ar
47
47
 
48
48
  If you use this software, please cite:
49
49
 
50
- Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.8) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
50
+ Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.9) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
51
51
 
52
52
 
53
53
  ## Installation
@@ -198,12 +198,9 @@ See the /tests directory for usage examples of most of the included functions.
198
198
  This software was developed without the use of AI-generated code. The GitHub Copilot Chat in Microsoft Visual Studio Code using the GPT-5 mini model (by OpenAI) was used solely to assist in drafting and refining docstrings for documentation. The corresponding guidelines and constraints defined by the author are documented in `AGENTS-docstrings.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
199
199
 
200
200
 
201
- ## What's new (v2.5.8)
201
+ ## What's new (v2.5.9)
202
202
 
203
203
  - Bugfixes
204
- - didtools.is_balanced() now conducts a truly comprehensive check whether the input panel data is balanced
205
- - Fixed bug in didtools.is_numeric() with respect to unintentional modification of the dataset
206
- - diddata.create_counterfactual() now catches error if no model was trained by didtools.model_wrapper()
207
- - didanalysis.DiffModel.plot_treatment_effects() now treats expections correctly
208
- - Other:
209
- - verbose option in any function which prints NOTEs, with all NOTEs being disabled when verbose = False
204
+ - Adjusting column naming to be compatible with newer pandas versions in `didanalysis.DiffModel.plot()`
205
+ - Check in `didtools.fit_metrics()` whether total sum of squares is positive before calculating $$R^2$$
206
+ - Incorrect access to counterfactual results in the event of model fit errors or model unavailability has been fixed in `diddata.create_counterfactual()`
@@ -21,7 +21,7 @@ A case study that utilizes the diffindiff library (preprint) is available on [ar
21
21
 
22
22
  If you use this software, please cite:
23
23
 
24
- Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.8) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
24
+ Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.9) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
25
25
 
26
26
 
27
27
  ## Installation
@@ -172,12 +172,9 @@ See the /tests directory for usage examples of most of the included functions.
172
172
  This software was developed without the use of AI-generated code. The GitHub Copilot Chat in Microsoft Visual Studio Code using the GPT-5 mini model (by OpenAI) was used solely to assist in drafting and refining docstrings for documentation. The corresponding guidelines and constraints defined by the author are documented in `AGENTS-docstrings.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
173
173
 
174
174
 
175
- ## What's new (v2.5.8)
175
+ ## What's new (v2.5.9)
176
176
 
177
177
  - Bugfixes
178
- - didtools.is_balanced() now conducts a truly comprehensive check whether the input panel data is balanced
179
- - Fixed bug in didtools.is_numeric() with respect to unintentional modification of the dataset
180
- - diddata.create_counterfactual() now catches error if no model was trained by didtools.model_wrapper()
181
- - didanalysis.DiffModel.plot_treatment_effects() now treats expections correctly
182
- - Other:
183
- - verbose option in any function which prints NOTEs, with all NOTEs being disabled when verbose = False
178
+ - Adjusting column naming to be compatible with newer pandas versions in `didanalysis.DiffModel.plot()`
179
+ - Check in `didtools.fit_metrics()` whether total sum of squares is positive before calculating $$R^2$$
180
+ - Incorrect access to counterfactual results in the event of model fit errors or model unavailability has been fixed in `diddata.create_counterfactual()`
@@ -4,15 +4,15 @@
4
4
  # Author: Thomas Wieland
5
5
  # ORCID: 0000-0001-5168-9846
6
6
  # mail: geowieland@googlemail.com
7
- # Version: 1.0.29
8
- # Last update: 2026-10-17 21:17
7
+ # Version: 1.0.30
8
+ # Last update: 2026-10-24 09:29
9
9
  # Copyright (c) 2025-2026 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
12
12
  # Basic config:
13
13
 
14
14
  PACKAGE_NAME = "diffindiff"
15
- PACKAGE_VERSION = "2.5.8"
15
+ PACKAGE_VERSION = "2.5.9"
16
16
 
17
17
  VERBOSE = False
18
18
 
@@ -4,8 +4,8 @@
4
4
  # Author: Thomas Wieland
5
5
  # ORCID: 0000-0001-5168-9846
6
6
  # mail: geowieland@googlemail.com
7
- # Version: 2.4.8
8
- # Last update: 2026-10-17 21:15
7
+ # Version: 2.4.9
8
+ # Last update: 2026-10-24 09:30
9
9
  # Copyright (c) 2024-2026 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
@@ -1877,19 +1877,21 @@ class DiffModel:
1877
1877
  outcome_col_expected_PI_lower_CG = f"{outcome_col}{config.DELIMITER}{config.EXPECTED_SUFFIX}{config.DELIMITER}{config.PI_LOWER_SUFFIX}{config.DELIMITER}{config.CG_COL}"
1878
1878
  outcome_col_expected_PI_upper_CG = f"{outcome_col}{config.DELIMITER}{config.EXPECTED_SUFFIX}{config.DELIMITER}{config.PI_UPPER_SUFFIX}{config.DELIMITER}{config.CG_COL}"
1879
1879
 
1880
- model_data_TG_CG.columns.values[0] = "t"
1881
- model_data_TG_CG.columns.values[1] = outcome_col_observed_TG
1882
- model_data_TG_CG.columns.values[2] = outcome_col_observed_CG
1883
- model_data_TG_CG.columns.values[3] = outcome_col_expected_TG
1884
- model_data_TG_CG.columns.values[4] = outcome_col_expected_CG
1885
- model_data_TG_CG.columns.values[5] = outcome_col_expected_CI_lower_TG
1886
- model_data_TG_CG.columns.values[6] = outcome_col_expected_CI_upper_TG
1887
- model_data_TG_CG.columns.values[7] = outcome_col_expected_CI_lower_CG
1888
- model_data_TG_CG.columns.values[8] = outcome_col_expected_CI_upper_CG
1889
- model_data_TG_CG.columns.values[9] = outcome_col_expected_PI_lower_TG
1890
- model_data_TG_CG.columns.values[10] = outcome_col_expected_PI_upper_TG
1891
- model_data_TG_CG.columns.values[11] = outcome_col_expected_PI_lower_CG
1892
- model_data_TG_CG.columns.values[12] = outcome_col_expected_PI_upper_CG
1880
+ model_data_TG_CG.columns = [
1881
+ "t",
1882
+ outcome_col_observed_TG,
1883
+ outcome_col_observed_CG,
1884
+ outcome_col_expected_TG,
1885
+ outcome_col_expected_CG,
1886
+ outcome_col_expected_CI_lower_TG,
1887
+ outcome_col_expected_CI_upper_TG,
1888
+ outcome_col_expected_CI_lower_CG,
1889
+ outcome_col_expected_CI_upper_CG,
1890
+ outcome_col_expected_PI_lower_TG,
1891
+ outcome_col_expected_PI_upper_TG,
1892
+ outcome_col_expected_PI_lower_CG,
1893
+ outcome_col_expected_PI_upper_CG,
1894
+ ]
1893
1895
 
1894
1896
  if plot_size_auto:
1895
1897
  if model_config["pre_post"]:
@@ -4,8 +4,8 @@
4
4
  # Author: Thomas Wieland
5
5
  # ORCID: 0000-0001-5168-9846
6
6
  # mail: geowieland@googlemail.com
7
- # Version: 2.3.4
8
- # Last update: 2026-10-17 21:34
7
+ # Version: 2.3.5
8
+ # Last update: 2026-10-30 21:20
9
9
  # Copyright (c) 2024-2026 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
@@ -2958,12 +2958,12 @@ def create_counterfactual(
2958
2958
  verbose = verbose
2959
2959
  )
2960
2960
 
2961
- model_estimation_error = counterfactual_pred[6]
2961
+ model_estimation_error = counterfactual_pred[5]
2962
2962
  model_estimation_error_text = ""
2963
2963
 
2964
2964
  if model_estimation_error:
2965
2965
 
2966
- model_estimation_error_text = counterfactual_pred[7]
2966
+ model_estimation_error_text = counterfactual_pred[6]
2967
2967
  print(f"WARNING: The desired {config.MODEL_WRAPPER_AVAILABLE[model_type]} model was not estimated. The following error occurred: '{model_estimation_error_text}'.")
2968
2968
 
2969
2969
  else:
@@ -4,8 +4,8 @@
4
4
  # Author: Thomas Wieland
5
5
  # ORCID: 0000-0001-5168-9846
6
6
  # mail: geowieland@googlemail.com
7
- # Version: 2.2.8
8
- # Last update: 2026-10-17 18:53
7
+ # Version: 2.2.9
8
+ # Last update: 2026-10-30 21:20
9
9
  # Copyright (c) 2025-2026 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
@@ -1618,6 +1618,7 @@ def model_wrapper(
1618
1618
  random_state = random_state
1619
1619
  )
1620
1620
  else:
1621
+ model = {}
1621
1622
  model_estimation_error = True
1622
1623
  model_estimation_error_text = "XGBRegressor is not available. Please install xgboost to use this model type."
1623
1624
 
@@ -1630,6 +1631,7 @@ def model_wrapper(
1630
1631
  random_state = random_state
1631
1632
  )
1632
1633
  else:
1634
+ model = {}
1633
1635
  model_estimation_error = True
1634
1636
  model_estimation_error_text = "LGBMRegressor is not available. Please install lightgbm to use this model type."
1635
1637
 
@@ -1656,7 +1658,8 @@ def model_wrapper(
1656
1658
  ]
1657
1659
  )
1658
1660
 
1659
- model.fit(X_train, y_train)
1661
+ if model != {}:
1662
+ model.fit(X_train, y_train)
1660
1663
 
1661
1664
  except Exception as e:
1662
1665
 
@@ -1870,7 +1873,11 @@ def fit_metrics(
1870
1873
  SAR = float(np.sum(residuals_abs))
1871
1874
  observed_mean = float(np.sum(observed)/observed_no)
1872
1875
  SQT = float(np.sum((observed-observed_mean)**2))
1873
- RSQ = float(1-(SSR/SQT))
1876
+
1877
+ RSQ = np.nan
1878
+ if SQT > 0:
1879
+ RSQ = float(1-(SSR/SQT))
1880
+
1874
1881
  MSE = float(SSR/observed_no)
1875
1882
  RMSE = float(np.sqrt(MSE))
1876
1883
  MAE = float(SAR/observed_no)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffindiff
3
- Version: 2.5.8
3
+ Version: 2.5.9
4
4
  Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
5
5
  Author: Thomas Wieland
6
6
  Author-email: geowieland@googlemail.com
@@ -47,7 +47,7 @@ A case study that utilizes the diffindiff library (preprint) is available on [ar
47
47
 
48
48
  If you use this software, please cite:
49
49
 
50
- Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.8) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
50
+ Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.9) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
51
51
 
52
52
 
53
53
  ## Installation
@@ -198,12 +198,9 @@ See the /tests directory for usage examples of most of the included functions.
198
198
  This software was developed without the use of AI-generated code. The GitHub Copilot Chat in Microsoft Visual Studio Code using the GPT-5 mini model (by OpenAI) was used solely to assist in drafting and refining docstrings for documentation. The corresponding guidelines and constraints defined by the author are documented in `AGENTS-docstrings.md` in the [public GitHub repository](https://github.com/geowieland/diffindiff_official).
199
199
 
200
200
 
201
- ## What's new (v2.5.8)
201
+ ## What's new (v2.5.9)
202
202
 
203
203
  - Bugfixes
204
- - didtools.is_balanced() now conducts a truly comprehensive check whether the input panel data is balanced
205
- - Fixed bug in didtools.is_numeric() with respect to unintentional modification of the dataset
206
- - diddata.create_counterfactual() now catches error if no model was trained by didtools.model_wrapper()
207
- - didanalysis.DiffModel.plot_treatment_effects() now treats expections correctly
208
- - Other:
209
- - verbose option in any function which prints NOTEs, with all NOTEs being disabled when verbose = False
204
+ - Adjusting column naming to be compatible with newer pandas versions in `didanalysis.DiffModel.plot()`
205
+ - Check in `didtools.fit_metrics()` whether total sum of squares is positive before calculating $$R^2$$
206
+ - Incorrect access to counterfactual results in the event of model fit errors or model unavailability has been fixed in `diddata.create_counterfactual()`
@@ -7,7 +7,7 @@ def read_README():
7
7
 
8
8
  setup(
9
9
  name='diffindiff',
10
- version='2.5.8',
10
+ version='2.5.9',
11
11
  description='diffindiff: Python library for convenient Difference-in-Differences analyses',
12
12
  packages=find_packages(include=["diffindiff", "diffindiff.tests"]),
13
13
  include_package_data=True,
File without changes
File without changes