BUG: Fix segfault on isnull(MultiIndex) by jtratner · Pull Request #5125 · pandas-dev/pandas (original) (raw)

One benefit of changing MI representation to not be a subclass of MultiIndex

Do u mean Index?

segfault is happening bc MI shape is 0 and a length 0 array is ultimately passed to lib.isnullobj which is not doing a manual bounds check before trying to access elements and it probably has the @cython.boundscheck(False) decorator enabled

why not just return a MultiIndex with True, False?

def _mi_is_null(mi): values = mi.values avalues = np.array(lmap(list, values), object) null = isnull(avalues) return MultiIndex.from_arrays(null, names=mi.names)

though the utility of this isn't so clear to me...why would you pass a MultiIndex to isnull in the first place? i agree with notimplementederror, but i also think at some point we should decide to return something and not raise