Skip to content

Commit 0d0264a

Browse files
committed
Work around numpy.diff error on boolean arrays
See numpy/numpy#9251
1 parent 5d4594c commit 0d0264a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎gismo.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def label_passes(df, label="amask"):
162162
passes. Default 'amask'.
163163
164164
"""
165-
idxs = np.nonzero(np.diff(df[label]))[0]
165+
idxs = np.nonzero(np.logical_xor(df[label][0:-1], df[label][1:]))[0]
166166
# ^ the resulting interval is closed: [a,b]. Be careful with
167167
# array slicing outside of pandas.
168168
idxs = list(idxs)

0 commit comments

Comments
 (0)