pd.Index.where¶ pandasIndex.where(cond, other=None) 支持的参数:¶ cond: 可以是一个布尔型的系列或一维数组 other: 可以是标量、非分类的系列、1维的numpy数组或与索引类型匹配的StringArray 不支持的索引类型 时间间隔索引 多重索引 重要 仅在其他元素与CategoricalIndex的类别相同(或是其子集)时,才支持CategoricalIndex。 示例用法¶ >>> @bodo.jit ... def f(I, C, O): ... return I.where(C, O) >>> I = pd.Index(["A", "B", "C", "D", "E"]) >>> C = pd.array([True, False, True, True, False]) >>> O = pd.Series(["a", "e", "i", "o", "u") >>> f(I, C, O) Index(['A', 'e', 'C', 'D', 'u'], dtype='object')