diffindiff 2.5.4__tar.gz → 2.5.5__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 (21) hide show
  1. {diffindiff-2.5.4 → diffindiff-2.5.5}/PKG-INFO +5 -9
  2. {diffindiff-2.5.4 → diffindiff-2.5.5}/README.md +4 -8
  3. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/config.py +3 -3
  4. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/didanalysis.py +28 -15
  5. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff.egg-info/PKG-INFO +5 -9
  6. {diffindiff-2.5.4 → diffindiff-2.5.5}/setup.py +1 -1
  7. {diffindiff-2.5.4 → diffindiff-2.5.5}/MANIFEST.in +0 -0
  8. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/__init__.py +0 -0
  9. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/didanalysis_helper.py +0 -0
  10. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/diddata.py +0 -0
  11. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/didtools.py +0 -0
  12. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/tests/__init__.py +0 -0
  13. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/tests/data/Corona_Hesse.xlsx +0 -0
  14. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/tests/data/counties_DE.csv +0 -0
  15. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/tests/data/curfew_DE.csv +0 -0
  16. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff/tests/tests_diffindiff.py +0 -0
  17. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff.egg-info/SOURCES.txt +0 -0
  18. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff.egg-info/dependency_links.txt +0 -0
  19. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff.egg-info/requires.txt +0 -0
  20. {diffindiff-2.5.4 → diffindiff-2.5.5}/diffindiff.egg-info/top_level.txt +0 -0
  21. {diffindiff-2.5.4 → diffindiff-2.5.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffindiff
3
- Version: 2.5.4
3
+ Version: 2.5.5
4
4
  Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
5
5
  Author: Thomas Wieland
6
6
  Author-email: geowieland@googlemail.com
@@ -29,7 +29,7 @@ A case study that utilizes the diffindiff library is available on [arXiv](https:
29
29
 
30
30
  If you use this software, please cite:
31
31
 
32
- Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.4) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
32
+ Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.5) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
33
33
 
34
34
 
35
35
  ## Installation
@@ -180,12 +180,8 @@ See the /tests directory for usage examples of most of the included functions.
180
180
  This software was developed without the use of AI-generated code. The Continue Agent 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).
181
181
 
182
182
 
183
- ## What's new (v2.5.4)
183
+ ## What's new (v2.5.5)
184
184
 
185
185
  - Bugfixes
186
- - Correction of the nonsensical skipping of the treatment group dummy in the case of two observation units in didanalysis.did_analysis()
187
- - Automatical drop of duplicates in results dictionaries in didanalysis_helper.extract_model_results()
188
- - Inefficient successive data insert in diddata.DiffData.add_synthetic() replaced by efficient concatenating
189
- - Other
190
- - Test script extended by another example
191
- - Cleaned dependencies
186
+ - didanalysis.did_analysis(): Correct usage of param 'log_outcome' in any case and check whether value of 'log_outcome_add' is appropriate
187
+ - didanalysis.DiffModel.plot() and didanalysis.DiffModel.plot_counterfactual(): Correct detection of the date format via object metadata
@@ -21,7 +21,7 @@ A case study that utilizes the diffindiff library is available on [arXiv](https:
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.4) [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.5) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
25
25
 
26
26
 
27
27
  ## Installation
@@ -172,12 +172,8 @@ 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 Continue Agent 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.4)
175
+ ## What's new (v2.5.5)
176
176
 
177
177
  - Bugfixes
178
- - Correction of the nonsensical skipping of the treatment group dummy in the case of two observation units in didanalysis.did_analysis()
179
- - Automatical drop of duplicates in results dictionaries in didanalysis_helper.extract_model_results()
180
- - Inefficient successive data insert in diddata.DiffData.add_synthetic() replaced by efficient concatenating
181
- - Other
182
- - Test script extended by another example
183
- - Cleaned dependencies
178
+ - didanalysis.did_analysis(): Correct usage of param 'log_outcome' in any case and check whether value of 'log_outcome_add' is appropriate
179
+ - didanalysis.DiffModel.plot() and didanalysis.DiffModel.plot_counterfactual(): Correct detection of the date format via object metadata
@@ -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.25
8
- # Last update: 2026-08-04 18:17
7
+ # Version: 1.0.26
8
+ # Last update: 2026-09-11 21:46
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.4"
15
+ PACKAGE_VERSION = "2.5.5"
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.5
8
- # Last update: 2026-08-03 20:25
7
+ # Version: 2.4.6
8
+ # Last update: 2026-09-11 21:46
9
9
  # Copyright (c) 2024-2026 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
@@ -1875,8 +1875,12 @@ class DiffModel:
1875
1875
  fig, ax = plt.subplots(figsize=(12, 6))
1876
1876
  else:
1877
1877
  fig, ax = plt.subplots(figsize=(plot_size[0], plot_size[1]))
1878
-
1879
- model_data_TG_CG["t"] = pd.to_datetime(model_data_TG_CG["t"])
1878
+
1879
+ date_format = model_config["date_format"]
1880
+ model_data_TG_CG["t"] = pd.to_datetime(
1881
+ model_data_TG_CG["t"],
1882
+ format = date_format
1883
+ )
1880
1884
 
1881
1885
  if not model_config["pre_post"]:
1882
1886
  pre_post_barplot = False
@@ -2022,7 +2026,7 @@ class DiffModel:
2022
2026
  plt.xlabel(x_label)
2023
2027
  plt.ylabel(y_label)
2024
2028
  plt.title(plot_title)
2025
- ax.xaxis.set_major_formatter(DateFormatter(model_config["date_format"]))
2029
+ ax.xaxis.set_major_formatter(DateFormatter(date_format))
2026
2030
 
2027
2031
  if model_config["pre_post"]:
2028
2032
 
@@ -2222,7 +2226,12 @@ class DiffModel:
2222
2226
  model_data_TG_mean_pred_counterfac.reset_index()
2223
2227
  ],
2224
2228
  axis = 1)
2225
- model_data_TG_mean[time_col] = pd.to_datetime(model_data_TG_mean[time_col])
2229
+
2230
+ date_format = model_config["date_format"]
2231
+ model_data_TG_mean[time_col] = pd.to_datetime(
2232
+ model_data_TG_mean[time_col],
2233
+ format=date_format
2234
+ )
2226
2235
 
2227
2236
  fig, ax = plt.subplots(figsize=(plot_size[0], plot_size[1]))
2228
2237
 
@@ -2725,13 +2734,15 @@ def did_analysis(
2725
2734
  print(f"NOTE: Input is {config.MULTIPERIOD_PANELDATA_DESCRIPTION}. Consider including {config.EFFECTS_TYPES['FE']['description']}.")
2726
2735
 
2727
2736
  if log_outcome:
2728
-
2729
- if missing_replace_by_zero:
2730
- data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col]+log_outcome_add)
2731
-
2737
+
2738
+ if any(data[outcome_col] <= 0):
2739
+ data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col]+log_outcome_add)
2732
2740
  else:
2733
2741
  data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col])
2734
-
2742
+
2743
+ if not np.isfinite(data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"]).all():
2744
+ print(f"WARNING: Outcome column '{outcome_col}' in input data contains values <= 0, which is not fully compensated by log_outcome_add = {log_outcome_add}. This may lead to NaN Inf values in the log-transformed outcome. Consider using a larger constant for log_outcome_add.")
2745
+
2735
2746
  outcome_col = f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"
2736
2747
 
2737
2748
  if not ITE and not GTE:
@@ -3320,12 +3331,14 @@ def ddd_analysis(
3320
3331
  pre_post = True
3321
3332
 
3322
3333
  if log_outcome:
3323
-
3324
- if missing_replace_by_zero:
3325
- data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col]+log_outcome_add)
3326
-
3334
+
3335
+ if any(data[outcome_col] <= 0):
3336
+ data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col]+log_outcome_add)
3327
3337
  else:
3328
3338
  data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"] = np.log(data[outcome_col])
3339
+
3340
+ if not np.isfinite(data[f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"]).all():
3341
+ print(f"WARNING: Outcome column '{outcome_col}' in input data contains values <= 0, which is not fully compensated by log_outcome_add = {log_outcome_add}. This may lead to NaN Inf values in the log-transformed outcome. Consider using a larger constant for log_outcome_add.")
3329
3342
 
3330
3343
  outcome_col = f"{config.LOG_PREFIX}{config.DELIMITER}{outcome_col}"
3331
3344
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffindiff
3
- Version: 2.5.4
3
+ Version: 2.5.5
4
4
  Summary: diffindiff: Python library for convenient Difference-in-Differences analyses
5
5
  Author: Thomas Wieland
6
6
  Author-email: geowieland@googlemail.com
@@ -29,7 +29,7 @@ A case study that utilizes the diffindiff library is available on [arXiv](https:
29
29
 
30
30
  If you use this software, please cite:
31
31
 
32
- Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.4) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
32
+ Wieland, T. (2026). diffindiff: A Python library for convenient difference-in-differences analyses (Version 2.5.5) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.18656820
33
33
 
34
34
 
35
35
  ## Installation
@@ -180,12 +180,8 @@ See the /tests directory for usage examples of most of the included functions.
180
180
  This software was developed without the use of AI-generated code. The Continue Agent 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).
181
181
 
182
182
 
183
- ## What's new (v2.5.4)
183
+ ## What's new (v2.5.5)
184
184
 
185
185
  - Bugfixes
186
- - Correction of the nonsensical skipping of the treatment group dummy in the case of two observation units in didanalysis.did_analysis()
187
- - Automatical drop of duplicates in results dictionaries in didanalysis_helper.extract_model_results()
188
- - Inefficient successive data insert in diddata.DiffData.add_synthetic() replaced by efficient concatenating
189
- - Other
190
- - Test script extended by another example
191
- - Cleaned dependencies
186
+ - didanalysis.did_analysis(): Correct usage of param 'log_outcome' in any case and check whether value of 'log_outcome_add' is appropriate
187
+ - didanalysis.DiffModel.plot() and didanalysis.DiffModel.plot_counterfactual(): Correct detection of the date format via object metadata
@@ -7,7 +7,7 @@ def read_README():
7
7
 
8
8
  setup(
9
9
  name='diffindiff',
10
- version='2.5.4',
10
+ version='2.5.5',
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