Skip to content

Commit

Permalink
Added changes from comment
Browse files Browse the repository at this point in the history
Chnaged license
corrected github url
removed dev_dependencies from build
removed init code from age_split sub directory
ruff formatted files
numpy format for doc in preprocess
  • Loading branch information
saalUW committed Apr 23, 2024
1 parent 3d74623 commit 538549e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = { text = "BSD 2-Clause License" }
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD 2-Clause License",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]

Expand All @@ -25,7 +25,7 @@ dependencies = [
requires-python = ">=3.6"

[project.urls]
homepage = "https://github.com/ihmeuw-msca/splitting-python-package"
homepage = "https://github.com/ihmeuw-msca/pydisagg"

[tool.setuptools.packages]
find = {}
Expand All @@ -38,7 +38,4 @@ log_cli_level = "INFO"
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
minversion = "6.0"
filterwarnings = "ignore"

[dev-dependencies]
pytest = "^8.1"
filterwarnings = "ignore"
3 changes: 0 additions & 3 deletions src/pydisagg/age_split/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# age_split/__init__.py
from . import age_split, age_var, helper

__all__ = ["age_split", "age_var", "helper"]
5 changes: 1 addition & 4 deletions src/pydisagg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class LMO_model(DisaggModel):
DisaggModel using the log-modified odds transformation with the exponent m.
"""

def __init__(
self,
m: float,
):
def __init__(self, m: float):
super().__init__(
parameter_transformation=transformations.LogModifiedOddsTransformation(
m
Expand Down
24 changes: 16 additions & 8 deletions src/pydisagg/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ def validate_data(df, pop_df, age_id_map=age_id_map):
"""
Validates the input dataframe by checking for NaN values, invalid sex_id, invalid location_ids, and invalid year_ids.
Args:
df (pandas.DataFrame): The input dataframe to be validated.
age_id_map (dict): A dictionary mapping age_ids to their corresponding values.
pop_df (pandas.DataFrame): The population dataframe used for validation.
Returns:
valid_df (pandas.DataFrame): The validated dataframe with invalid rows removed.
nan_df (pandas.DataFrame): A dataframe containing the rows with validation errors and their corresponding error reasons.
Parameters
----------
df : pandas.DataFrame
The input dataframe to be validated.
age_id_map : dict
A dictionary mapping age_ids to their corresponding values.
pop_df : pandas.DataFrame
The population dataframe used for validation.
Returns
-------
valid_df : pandas.DataFrame
The validated dataframe with invalid rows removed.
nan_df : pandas.DataFrame
A dataframe containing the rows with validation errors and their corresponding error reasons.
"""

if "year_id" in df.columns:
df["input_year_id"] = df["year_id"]

Expand Down

0 comments on commit 538549e

Please sign in to comment.