Skip to content
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

Yield the same order regardless of order in the file and database #2187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 4 additions & 0 deletions soda/scientific/soda/scientific/distribution/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ def evaluate(self) -> dict[str, float]:
ref_data_frequencies = ref_data_frequencies + 1
test_data_frequencies = test_data_frequencies + 1

# sort the data to make sure that the categories are in the same order before cast to array_like
ref_data_frequencies = ref_data_frequencies.sort_index()
test_data_frequencies = test_data_frequencies.sort_index()

# Normalise because scipy wants sums of observed and reference counts to be equal
# workaround found and discussed in: https://github.com/UDST/synthpop/issues/75#issuecomment-907137304
stat_value, p_value = chisquare(
Expand Down