Skip to content

Commit

Permalink
Merge pull request #55 from sdfordham/future-py38
Browse files Browse the repository at this point in the history
use future for py3.8
  • Loading branch information
sdfordham authored May 5, 2024
2 parents 0cabf76 + 101d02d commit ffa1100
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pysyncon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def att(
if Z0 is not None and Z1 is not None:
gaps = self._gaps(Z0=Z0.loc[time_period, :], Z1=Z1.loc[time_period])
else:
raise ValueError("dataprep must be set or (Z0, Z1) must be set for plots.")
raise ValueError("dataprep must be set or (Z0, Z1) must be set for att.")
att = np.mean(gaps)
se = np.std(gaps, ddof=1) / np.sqrt(len(time_period))

Expand Down
17 changes: 9 additions & 8 deletions pysyncon/generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional, Tuple
from __future__ import annotations
from typing import Optional

import numpy as np
import pandas as pd
Expand All @@ -9,12 +10,12 @@ class LinearFactorModel:

def __init__(
self,
observed_dist: Tuple[int] = (0, 1),
observed_params_dist: Tuple[int] = (0, 10),
unobserved_dist: Tuple[int] = (0, 1),
unobserved_params_dist: Tuple[int] = (0, 10),
effect_dist: Tuple[int] = (0, 20),
shocks_dist: Tuple[int] = (0, 1),
observed_dist: tuple[int] = (0, 1),
observed_params_dist: tuple[int] = (0, 10),
unobserved_dist: tuple[int] = (0, 1),
unobserved_params_dist: tuple[int] = (0, 10),
effect_dist: tuple[int] = (0, 20),
shocks_dist: tuple[int] = (0, 1),
seed: Optional[int] = None,
rng: Optional[np.random.Generator] = None,
) -> None:
Expand Down Expand Up @@ -60,7 +61,7 @@ def generate(
n_unobservable: int,
n_periods_pre: int,
n_periods_post: int,
) -> Tuple[pd.DataFrame, pd.Series, pd.DataFrame, pd.Series]:
) -> tuple[pd.DataFrame, pd.Series, pd.DataFrame, pd.Series]:
"""Generate the matrices (:math:`X_0`, :math:`X_1`, :math:`Z_0`,
:math:`Z_1`) that can be used as input to a synthetic control
method (using the notation of Abadie & Gardeazabal :cite:`basque2003`).
Expand Down

0 comments on commit ffa1100

Please sign in to comment.