Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsnow committed Nov 25, 2024
1 parent a125dda commit 4ae9362
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dbt/models/reporting/reporting.ratio_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# type: ignore
sc.addPyFile("s3://ccao-athena-dependencies-us-east-1/assesspy==2.0.0.zip")

from typing import Union

import assesspy as ap
import pandas as pd
from pyspark.sql.functions import col, lit
Expand All @@ -12,8 +14,8 @@


def ccao_drop_outliers(
estimate: list[int] | list[float] | pd.Series,
sale_price: list[int] | list[float] | pd.Series,
estimate: Union[list[int], list[float], pd.Series],
sale_price: Union[list[int], list[float], pd.Series],
) -> tuple[pd.Series, pd.Series, float]:
"""
Helper function to drop the top and bottom N% (usually 5%) of the input
Expand All @@ -35,9 +37,9 @@ def ccao_drop_outliers(

def ccao_metric(
fun: callable,
estimate: list[int] | list[float] | pd.Series,
sale_price: list[int] | list[float] | pd.Series,
) -> list[float | None]:
estimate: Union[list[int], list[float], pd.Series],
sale_price: Union[list[int], list[float], pd.Series],
) -> list[Union[float, None]]:
"""
Helper function to calculate a metric, its confidence interval, and
whether the metric meets the IAAO/Quintos standard. Also checks if the
Expand All @@ -63,8 +65,8 @@ def ccao_metric(


def ccao_median(
estimate: list[int] | list[float] | pd.Series,
sale_price: list[int] | list[float] | pd.Series,
estimate: Union[list[int], list[float], pd.Series],
sale_price: Union[list[int], list[float], pd.Series],
) -> list[float]:
"""
Calculates the median ratio of estimate to sale price, excluding outliers.
Expand Down

0 comments on commit 4ae9362

Please sign in to comment.