Skip to content

Commit

Permalink
check for invalid groups
Browse files Browse the repository at this point in the history
  • Loading branch information
AFg6K7h4fhy2 committed Jan 29, 2025
1 parent 0ad7c24 commit 9452acd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion forecasttools/idata_to_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ def convert_inference_data_to_tidydraws(
A dictionary of groups from the idata
for use with the tidybayes API.
"""
available_groups = list(idata.groups())
if groups is None:
groups = list(idata.groups())
groups = available_groups
else:
invalid_groups = [group for group in groups if group not in available_groups]
if invalid_groups:
raise ValueError(f"Invalid groups provided: {invalid_groups}. Available groups: {available_groups}")

idata_df = pl.DataFrame(idata.to_dataframe())

tidy_dfs = {
Expand Down

0 comments on commit 9452acd

Please sign in to comment.