Skip to content

Commit

Permalink
fix: correct filter fields copy behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrasser committed Apr 4, 2024
1 parent 485f7e8 commit 051ac16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cryosparc/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def filter_fields(self, names: Union[Collection[str], Callable[[str], bool]], *,
test = (lambda n: n in names) if isinstance(names, Collection) else names
new_fields = [f for f in self.fields() if f == "uid" or test(f)]
if len(new_fields) == self._data.ncol():
return self # nothing to filter
return self.copy() if copy else self # nothing to filter

result = type(self)([(key, self[key]) for key in new_fields])
return result if copy else self._reset(result._data)
Expand Down

0 comments on commit 051ac16

Please sign in to comment.