File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1992,13 +1992,18 @@ def _from_combined(self, combined: np.ndarray) -> IntervalArray:
1992
1992
def unique (self ) -> IntervalArray :
1993
1993
# Using .view("complex128") with negatives causes issues. # GH#61917
1994
1994
combined = self ._combined
1995
- if not combined .flags .c_contiguous :
1996
- combined = np .ascontiguousarray (combined )
1997
- structured = combined .view (
1998
- [("left" , combined .dtype ), ("right" , combined .dtype )]
1999
- )[:, 0 ]
2000
- unique_structured = unique (structured )
2001
- nc = unique_structured .view (combined .dtype )
1995
+ combined = np .ascontiguousarray (combined )
1996
+ if combined .dtype == np .object_ :
1997
+ nc = unique (
1998
+ self ._combined .view ("complex128" )[:, 0 ] # type: ignore[call-overload]
1999
+ )
2000
+ nc = nc [:, None ]
2001
+ else :
2002
+ structured = combined .view (
2003
+ [("left" , combined .dtype ), ("right" , combined .dtype )]
2004
+ )[:, 0 ]
2005
+ unique_structured = unique (structured )
2006
+ nc = unique_structured .view (combined .dtype )
2002
2007
return self ._from_combined (nc )
2003
2008
2004
2009
You can’t perform that action at this time.
0 commit comments