Skip to content

Commit

Permalink
fix #413
Browse files Browse the repository at this point in the history
  • Loading branch information
ejolly committed Mar 7, 2023
1 parent e158aff commit 27d2ce2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nltools/data/design_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,8 @@ def clean(self, fill_na=0, exclude_polys=False, thresh=0.95, verbose=True):
)

old_settings = np.seterr(all="ignore")

out = self.copy()
if fill_na is not None:
out = self.fillna(fill_na)

Expand Down
4 changes: 4 additions & 0 deletions nltools/tests/test_design_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def test_clean(sim_design_matrix):
out = corr_cols.clean(verbose=True)
assert out.shape[1] < corr_cols.shape[1]

# Test for bug #413 about args combinations
out = corr_cols.clean(fill_na=None, exclude_polys=True, verbose=True)
assert out.shape[1] < corr_cols.shape[1]

# Raise an error if try to clean with an input matrix that has duplicate column names
dup_cols = pd.concat([sim_design_matrix, sim_design_matrix], axis=1)
with pytest.raises(ValueError):
Expand Down

0 comments on commit 27d2ce2

Please sign in to comment.