Skip to content

[pre-commit.ci] pre-commit autoupdate #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
args: ["--verbose"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.11
rev: v0.11.13
hooks:
- id: ruff
args: ["--fix", "--output-format=full"]
Expand All @@ -34,7 +34,7 @@ repos:
files: ^docs/.*\.ipynb$

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: v1.16.0
hooks:
- id: mypy
args: [--ignore-missing-imports]
Expand Down
2 changes: 1 addition & 1 deletion pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyfixest/did/saturated_twfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def compute_period_weights(
if include_grid:
all_periods = sorted(df[period].unique())
grid = pd.MultiIndex.from_product(
[ever_treated, all_periods], names=[cohort, period]
[list(ever_treated), all_periods], names=[cohort, period]
).to_frame(index=False)
out = grid.merge(out, on=[cohort, period], how="left")
out["weight"] = out["weight"].fillna(0.0)
Expand Down
30 changes: 30 additions & 0 deletions pyfixest/estimation/feols_.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@
the _model_name_plot attribute will be modified.
_quantile: Optional[float]
The quantile used for quantile regression. None if not a quantile regression.

# special for did
_res_cohort_eventtime_dict: Optional[dict[str, Any]]
_yname: Optional[str]
_gname: Optional[str]
_tname: Optional[str]
_idname: Optional[str]
_att: Optional[Any]
test_treatment_heterogeneity: Callable[..., Any]
aggregate: Callable[..., Any]
iplot_aggregate: Callable[..., Any]

"""

def __init__(
Expand Down Expand Up @@ -356,6 +368,14 @@
# special for poisson
self.deviance = None

# special for did
self._res_cohort_eventtime_dict: Optional[dict[str, Any]] = None
self._yname: Optional[str] = None
self._gname: Optional[str] = None
self._tname: Optional[str] = None
self._idname: Optional[str] = None
self._att: Optional[bool] = None

# set functions inherited from other modules
_module = import_module("pyfixest.report")
_tmp = _module.coefplot
Expand All @@ -368,6 +388,16 @@
self.summary = functools.partial(_tmp, models=[self])
self.summary.__doc__ = _tmp.__doc__

# DiD methods - assign placeholder functions
def _not_implemented_did(*args, **kwargs):
raise NotImplementedError(
"This method is only available for DiD models, not for vanilla 'feols'."
)

Check warning on line 395 in pyfixest/estimation/feols_.py

View check run for this annotation

Codecov / codecov/patch

pyfixest/estimation/feols_.py#L395

Added line #L395 was not covered by tests

self.test_treatment_heterogeneity = _not_implemented_did
self.aggregate = _not_implemented_did
self.iplot_aggregate = _not_implemented_did

def prepare_model_matrix(self):
"Prepare model matrices for estimation."
mm_dict = model_matrix_fixest(
Expand Down
2 changes: 1 addition & 1 deletion pyfixest/estimation/fepois_.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def _check_for_separation_fe(
"""
separation_na: set[int] = set()
if fe is not None and not (Y > 0).all(axis=0).all():
Y_help = (Y > 0).astype(int).squeeze()
Y_help = (Y.iloc[:, 0] > 0).astype(int)

# loop over all elements of fe
for x in fe.columns:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ docstring-code-format = true
docstring-code-line-length = 88

[tool.mypy]
plugins = "numpy.typing.mypy_plugin"

[[tool.mypy.overrides]]
module = [
Expand Down
Loading