Skip to content

Commit

Permalink
In the test, the index is duplicated, causing .at to return multiple …
Browse files Browse the repository at this point in the history
…rows, which is incorrect

Use .loc instead which is designed to return multiple rows
now returns series instead of np array
  • Loading branch information
aamster committed Dec 8, 2021
1 parent 854b5dc commit d0a4ae7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions allensdk/test_utilities/custom_comparators.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def safe_df_comparison(expected: pd.DataFrame,
msg += '\nindex mismatch in non-null when checking '
msg += f'{col}\n'
for index_val in expected_valid.index.values:
e = expected_valid.at[index_val, col]
o = obtained_valid.at[index_val, col]
if isinstance(e, np.ndarray):
e = expected_valid.loc[index_val, col]
o = obtained_valid.loc[index_val, col]
if isinstance(e, pd.Series):
e = list(e)
if isinstance(o, np.ndarray):
if isinstance(o, pd.Series):
o = list(o)
if not e == o:
msg += f'\n{col}\n'
Expand Down

0 comments on commit d0a4ae7

Please sign in to comment.